Image decoding method comprising generating prediction samples by applying determined prediction mode, and device therefor

ABSTRACT

According to the disclosure of the present document, when the inter prediction type of a current block indicates biprediction, weight index information for candidates in a merge candidate list or a sub-block merge candidate list can be derived, and thus coding efficiency can be increased.

BACKGROUND OF THE DISCLOSURE Field of the Disclosure

The present disclosure relates to an image decoding method forgenerating prediction samples by applying a determined prediction modeand an apparatus thereof.

Related Art

Recently, the demand for high resolution, high quality image/video suchas 4K, 8K or more Ultra High Definition (UHD) image/video is increasingin various fields. As the image/video resolution or quality becomeshigher, relatively more amount of information or bits are transmittedthan for conventional image/video data. Therefore, if image/video dataare transmitted via a medium such as an existing wired/wirelessbroadband line or stored in a legacy storage medium, costs fortransmission and storage are readily increased.

Moreover, interests and demand are growing for virtual reality (VR) andartificial reality (AR) contents, and immersive media such as hologram;and broadcasting of images/videos exhibiting image/video characteristicsdifferent from those of an actual image/video, such as gameimages/videos, are also growing.

Therefore, a highly efficient image/video compression technique isrequired to effectively compress and transmit, store, or play highresolution, high quality images/videos showing various characteristicsas described above.

SUMMARY

The present disclosure provides a method and apparatus for increasingimage coding efficiency.

The present disclosure also provides a method and an apparatus forderiving a prediction sample based on a default merge mode when a mergemode is not finally selected.

The present disclosure also provides a method and apparatus for derivinga prediction sample by applying a regular merge mode as a default mergemode.

In an aspect, an image decoding method performed by a decoding apparatusis provided. The method includes: acquiring image information includinginter prediction mode information and residual information through abitstream; generating residual samples based on the residualinformation; generating prediction samples of a current block byapplying a prediction mode determined based on the inter prediction modeinformation; and generating reconstructed samples based on theprediction samples and the residual samples, wherein the interprediction mode information includes a general merge flag indicatingwhether a merge mode is available for the current block, a regular mergemode is applied based on that a merge mode is available for the currentblock based on the general merge flag and a merge mode with motionvector difference (MMVD) mode, a merge subblock mode, a combinedinter-picture merge and intra-picture prediction (CIIP) mode, and apartitioning mode in which prediction is performed by dividing thecurrent block into two partitions are not available, the interprediction mode information includes merge index information indicatingone of merge candidates included in a merge candidate list generated byapplying the regular merge mode, and the prediction samples aregenerated using the merge index information.

In another aspect, an image encoding method performed by an encodingapparatus is provided. The method includes: determining an interprediction mode of a current block and generating inter prediction modeinformation indicating the inter prediction mode; generating predictionsamples of the current block based on the determined prediction mode;generating residual information based on residual samples for thecurrent block; and encoding image information including the interprediction mode information and the residual information, wherein theinter prediction mode information includes a general merge flagindicating whether a merge mode is available for the current block, aregular merge mode is applied based on that a merge mode with motionvector difference (MMVD) mode, a merge subblock mode, a combinedinter-picture merge and intra-picture prediction (CIIP) mode, and apartitioning mode in which prediction is performed by dividing thecurrent block into two partitions are not available.

The inter prediction mode information includes merge index informationindicating one of the merge candidates included in the merge candidatelist generated by applying the regular merge mode.

In another aspect, there is provided a computer-readable storage mediumstoring encoded information causing an image decoding apparatus toperform an image decoding method, wherein the image decoding methodincludes: acquiring image information including inter prediction modeinformation and residual information through a bitstream; generatingresidual samples based on the residual information; generatingprediction samples of a current block by applying a prediction modedetermined based on the inter prediction mode information; andgenerating reconstructed samples based on the prediction samples and theresidual samples, wherein the inter prediction mode information includesa general merge flag indicating whether a merge mode is available forthe current block, a regular merge mode is applied based on that a mergemode is available for the current block based on the general merge flagand a merge mode with motion vector difference (MMVD) mode, a mergesubblock mode, a combined inter-picture merge and intra-pictureprediction (CIIP) mode, and a partitioning mode in which prediction isperformed by dividing the current block into two partitions are notavailable.

The inter prediction mode information includes merge index informationindicating one candidate among merge candidates included in a mergecandidate list generated by applying the regular merge mode, and theprediction samples are generated using the merge index information.

Advantageous Effects

According to the present disclosure, overall image/video compressionefficiency may be improved.

According to the present disclosure, inter prediction may be efficientlyperformed by applying a default merge mode when a merge mode is notfinally selected.

According to the present disclosure, when the merge mode is not finallyselected, the regular merge mode is applied and motion information isderived based on a candidate indicated by merge index information,thereby efficiently performing inter prediction.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 schematically shows an example of a video/image coding system towhich embodiments of the present disclosure is applied.

FIG. 2 is a diagram schematically illustrating a configuration of avideo/image encoding apparatus to which embodiments of the presentdocument may be applied.

FIG. 3 is a diagram schematically illustrating a configuration of avideo/image decoding apparatus to which embodiments of the presentdocument may be applied.

FIG. 4 is a view illustrating an example of a video/image encodingmethod based on inter prediction.

FIG. 5 is a diagram schematically illustrating an inter predictor in anencoding apparatus.

FIG. 6 is a view illustrating an example of a video/image decodingmethod based on inter prediction.

FIG. 7 is a diagram schematically illustrating an inter predictor in adecoding apparatus.

FIG. 8 is a view illustrating a merge mode in inter prediction.

FIG. 9 is a view illustrating a merge mode with motion vector differencemode (MMVD) in inter prediction.

FIGS. 10A and 10B exemplarily show CPMV for affine motion prediction.

FIG. 11 exemplarily shows a case in which an affine MVF is determined insub-block units.

FIG. 12 is a view illustrating an affine merge mode or a subblock mergemode in inter prediction.

FIG. 13 is a view illustrating positions of candidates in an affinemerge mode or a sub-block merge mode.

FIG. 14 is a view illustrating SbTMVP in inter prediction.

FIG. 15 is a view illustrating a combined inter-picture merge andintra-picture prediction (CIIP) mode in inter prediction.

FIG. 16 is a view illustrating a partitioning mode in inter prediction.

FIGS. 17 and 18 schematically show an example of a video/image encodingmethod and related components according to embodiment(s) of the presentdisclosure.

FIGS. 19 and 20 schematically show an example of an image/video decodingmethod and related components according to embodiment(s) of the presentdisclosure.

FIG. 21 shows an example of a content streaming system to which theembodiments disclosed in the present disclosure may be applied.

DESCRIPTION OF EXEMPLARY EMBODIMENTS

The disclosure may be variously modified in various forms and may havevarious embodiments, and specific embodiments thereof will beillustrated in the drawings and described in detail. However, theseembodiments are not intended for limiting the disclosure. Terms used inthe below description are used to merely describe specific embodiments,but are not intended for limiting the technical spirit of thedisclosure. An expression of a singular number includes an expression ofa plural number, so long as it is clearly read differently. Terms suchas “include” and “have” in this description are intended for indicatingthat features, numbers, steps, operations, elements, components, orcombinations thereof used in the below description exist, and it shouldbe thus understood that the possibility of existence or addition of oneor more different features, numbers, steps, operations, elements,components, or combinations thereof is not excluded.

Meanwhile, elements of the drawings described in the disclosure areindependently drawn for the purpose of convenience of explanation ondifferent specific functions, and do not mean that the elements areembodied by independent hardware or independent software. For example,two or more elements out of the elements may be combined to form asingle element, or one element may be split into plural elements.Embodiments in which the elements are combined and/or split belong tothe scope of the disclosure.

This document relates to video/image coding. For example, amethod/embodiment disclosed in this document may be applied to a methoddisclosed in a versatile video coding (VVC) standard. In addition, themethod/embodiment disclosed in this document may be applied to a methoddisclosed in an essential video coding (EVC) standard, AOMedia Video 1(AV1) standard, 2nd generation of audio video coding standard (AVS2), ora next-generation video/image coding standard (ex. H.267 or H.268,etc.).

This document presents various embodiments related to video/imagecoding, and unless otherwise stated, the embodiments may be combinedwith each other.

Hereinafter, embodiments of the present document will be described withreference to the accompanying drawings. Hereinafter, the same referencenumerals may be used for the same components in the drawings, andrepeated descriptions of the same components may be omitted.

FIG. 1 illustrates an example of a video/image coding system to whichthe embodiments of the present disclosure may be applied.

Referring to FIG. 1 , a video/image coding system may include a firstdevice (a source device) and a second device (a reception device). Thesource device may transmit encoded video/image information or data tothe reception device through a digital storage medium or network in theform of a file or streaming.

The source device may include a video source, an encoding apparatus, anda transmitter. The receiving device may include a receiver, a decodingapparatus, and a renderer. The encoding apparatus may be called avideo/image encoding apparatus, and the decoding apparatus may be calleda video/image decoding apparatus. The transmitter may be included in theencoding apparatus. The receiver may be included in the decodingapparatus. The renderer may include a display, and the display may beconfigured as a separate device or an external component.

The video source may acquire video/image through a process of capturing,synthesizing, or generating the video/image. The video source mayinclude a video/image capture device and/or a video/image generatingdevice. The video/image capture device may include, for example, one ormore cameras, video/image archives including previously capturedvideo/images, and the like. The video/image generating device mayinclude, for example, computers, tablets and smartphones, and may(electronically) generate video/images. For example, a virtualvideo/image may be generated through a computer or the like. In thiscase, the video/image capturing process may be replaced by a process ofgenerating related data.

The encoding apparatus may encode input video/image. The encodingapparatus may perform a series of procedures such as prediction,transform, and quantization for compaction and coding efficiency. Theencoded data (encoded video/image information) may be output in the formof a bitstream.

The transmitter may transmit the encoded image/image information or dataoutput in the form of a bitstream to the receiver of the receivingdevice through a digital storage medium or a network in the form of afile or streaming. The digital storage medium may include variousstorage mediums such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, and thelike. The transmitter may include an element for generating a media filethrough a predetermined file format and may include an element fortransmission through a broadcast/communication network. The receiver mayreceive/extract the bitstream and transmit the received bitstream to thedecoding apparatus.

The decoding apparatus may decode the video/image by performing a seriesof procedures such as dequantization, inverse transform, and predictioncorresponding to the operation of the encoding apparatus.

The renderer may render the decoded video/image. The renderedvideo/image may be displayed through the display.

The present disclosure relates to video/image coding. For example, themethod/embodiment disclosed in the present disclosure may be applied tothe methods disclosed in a verstatile video coding (VVC) standard, anessential video coding (EVC) standard, an AOMedia Video 1 (AV1)standard, 2nd generation of audio video coding standard (AVS2), or anext-generation video/image coding standard (ex. H.267 or H.268, etc).

This document suggests various embodiments of video/image coding, andthe above embodiments may also be performed in combination with eachother unless otherwise specified.

In this document, a video may refer to a series of images over time. Apicture generally refers to the unit representing one image at aparticular time frame, and a slice/tile refers to the unit constitutinga part of the picture in terms of coding. A slice/tile may include oneor more coding tree units (CTUs). One picture may consist of one or moreslices/tiles.

A tile is a rectangular region of CTUs within a particular tile columnand a particular tile row in a picture. The tile column is a rectangularregion of CTUs having a height equal to the height of the picture and awidth specified by syntax elements in the picture parameter set. Thetile row is a rectangular region of CTUs having a height specified bysyntax elements in the picture parameter set and a width equal to thewidth of the picture. A tile scan is a specific sequential ordering ofCTUs partitioning a picture in which the CTUs are ordered consecutivelyin CTU raster scan in a tile whereas tiles in a picture are orderedconsecutively in a raster scan of the tiles of the picture. A slice maycomprise a number of complete tiles or a number of consecutive CTU rowsin one tile of a picture that may be contained in one NAL unit. In thisdocument, tile group and slice can be used interchangeably. For example,in this document, a tile group/tile group header may be referred to as aslice/slice header.

Meanwhile, one picture may be divided into two or more subpictures. Thesubpicture may be a rectangular region of one or more slices within apicture.

A pixel or a pel may mean a smallest unit constituting one picture (orimage). Also, ‘sample’ may be used as a term corresponding to a pixel. Asample may generally represent a pixel or a value of a pixel, and mayrepresent only a pixel/pixel value of a luma component or only apixel/pixel value of a chroma component.

A unit may represent a basic unit of image processing. The unit mayinclude at least one of a specific region of the picture and informationrelated to the region. One unit may include one luma block and twochroma (ex. cb, cr) blocks. The unit may be used interchangeably withterms such as block or area in some cases. In a general case, an M×Nblock may include samples (or sample arrays) or a set (or array) oftransform coefficients of M columns and N rows. Alternatively, thesample may mean a pixel value in the spatial domain, and when such apixel value is transformed to the frequency domain, it may mean atransform coefficient in the frequency domain.

In this document, “A or B (A or B)” may mean “only A”, “only B”, or“both A and B”. In other words, “A or B (A or B)” in this document maybe interpreted as “A and/or B (A and/or B)”. For example, in thisdocument “A, B or C (A, B or C)” means “only A”, “only B”, “only C”, or“any and any combination of A, B and C”.

A slash (/) or comma used in this document may mean “and/or”. Forexample, “A/B” may mean “A and/or B”. Accordingly, “A/B” may mean “onlyA”, “only B”, or “both A and B”. For example, “A, B, C” may mean “A, B,or C”.

In this document, “at least one of A and B” may mean “only A”, “only B”,or “both A and B”. Also, in this document, the expression “at least oneof A or B” or “at least one of A and/or B” may be interpreted equally as“at least one of A and B)”.

Also, in this document “at least one of A, B and C” means “only A”,“only B”, “only C”, or “any combination of A, B and C”. Also, “at leastone of A, B or C” or “at least one of A, B and/or C” may mean “at leastone of A, B and C”.

Also, parentheses used in this document may mean “for example”.Specifically, when “prediction (intra prediction)” is indicated, it maybe referred to as that “intra prediction” is proposed as an example of“prediction”. In other words, “prediction” in this document is notlimited to “intra prediction”, and “intra prediction” may be proposed asan example of “prediction”. Also, even when “prediction (i.e., intraprediction)” is indicated, it may be referred to as that “intraprediction” is proposed as an example of “prediction”.

Technical features that are individually described in one drawing inthis document may be implemented individually or simultaneously.

FIG. 2 is a diagram schematically illustrating the configuration of avideo/image encoding apparatus to which the disclosure of the presentdocument may be applied. Hereinafter, what is referred to as the videoencoding apparatus may include an image encoding apparatus.

Referring to FIG. 2 , the encoding apparatus 200 may include and beconfigured with an image partitioner 210, a predictor 220, a residualprocessor 230, an entropy encoder 240, an adder 250, a filter 260, and amemory 270. The predictor 220 may include an inter predictor 221 and anintra predictor 222. The residual processor 230 may include atransformer 232, a quantizer 233, a dequantizer 234, and an inversetransformer 235. The residual processor 230 may further include asubtractor 231. The adder 250 may be called a reconstructor orreconstructed block generator. The image partitioner 210, the predictor220, the residual processor 230, the entropy encoder 240, the adder 250,and the filter 260, which have been described above, may be configuredby one or more hardware components (e.g., encoder chipsets orprocessors) according to an embodiment. In addition, the memory 270 mayinclude a decoded picture buffer (DPB), and may also be configured by adigital storage medium. The hardware component may further include thememory 270 as an internal/external component.

The image partitioner 210 may split an input image (or, picture, frame)input to the encoding apparatus 200 into one or more processing units.As an example, the processing unit may be called a coding unit (CU). Inthis case, the coding unit may be recursively split according to aQuad-tree binary-tree ternary-tree (QTBTTT) structure from a coding treeunit (CTU) or the largest coding unit (LCU). For example, one codingunit may be split into a plurality of coding units of a deeper depthbased on a quad-tree structure, a binary-tree structure, and/or aternary-tree structure. In this case, for example, the quad-treestructure is first applied and the binary-tree structure and/or theternary-tree structure may be later applied. Alternatively, thebinary-tree structure may also be first applied. A coding procedureaccording to the present disclosure may be performed based on a finalcoding unit which is not split any more. In this case, based on codingefficiency according to image characteristics or the like, the maximumcoding unit may be directly used as the final coding unit, or asnecessary, the coding unit may be recursively split into coding units ofa deeper depth, such that a coding unit having an optimal size may beused as the final coding unit. Here, the coding procedure may include aprocedure such as prediction, transform, and reconstruction to bedescribed later. As another example, the processing unit may furtherinclude a predictor (PU) or a transform unit (TU). In this case, each ofthe predictor and the transform unit may be split or partitioned fromthe aforementioned final coding unit. The predictor may be a unit ofsample prediction, and the transform unit may be a unit for inducing atransform coefficient and/or a unit for inducing a residual signal fromthe transform coefficient.

The unit may be interchangeably used with the term such as a block or anarea in some cases. Generally, an M×N block may represent samplescomposed of M columns and N rows or a group of transform coefficients.The sample may generally represent a pixel or a value of the pixel, andmay also represent only the pixel/pixel value of a luma component, andalso represent only the pixel/pixel value of a chroma component. Thesample may be used as the term corresponding to a pixel or a pelconfiguring one picture (or image).

The encoding apparatus 200 may subtract the prediction signal (predictedblock, prediction sample array) output from the inter predictor 221 orthe intra predictor 222 from the input image signal (original block,original sample array) to generate a residual signal (residual block,residual sample array), and the generated residual signal is transmittedto the transformer 232. In this case, as illustrated, a unit forsubtracting the prediction signal (prediction block, prediction samplearray) from an input image signal (original block, original samplearray) in the encoder 200 may be referred to as a subtractor 231. Thepredictor may perform prediction on a processing target block(hereinafter, referred to as a current block) and generate a predictedblock including prediction samples for the current block. The predictormay determine whether intra prediction or inter prediction is applied inunits of a current block or CU. The predictor may generate variousinformation on prediction, such as prediction mode information, andtransmit the generated information to the entropy encoder 240, as isdescribed below in the description of each prediction mode. Theinformation on prediction may be encoded by the entropy encoder 240 andoutput in the form of a bitstream.

The intra predictor 222 may predict a current block with reference tosamples within a current picture. The referenced samples may be locatedneighboring to the current block, or may also be located away from thecurrent block according to the prediction mode. The prediction modes inthe intra prediction may include a plurality of non-directional modesand a plurality of directional modes. The non-directional mode mayinclude, for example, a DC mode or a planar mode. The directional modemay include, for example, 33 directional prediction modes or 65directional prediction modes according to the fine degree of theprediction direction. However, this is illustrative and the directionalprediction modes which are more or less than the above number may beused according to the setting. The intra predictor 222 may alsodetermine the prediction mode applied to the current block using theprediction mode applied to the neighboring block.

The inter predictor 221 may induce a predicted block of the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. At this time, in order to decreasethe amount of motion information transmitted in the inter predictionmode, the motion information may be predicted in units of a block, asub-block, or a sample based on the correlation of the motioninformation between the neighboring block and the current block. Themotion information may include a motion vector and a reference pictureindex. The motion information may further include inter predictiondirection (L0 prediction, L1 prediction, Bi prediction, or the like)information. In the case of the inter prediction, the neighboring blockmay include a spatial neighboring block existing within the currentpicture and a temporal neighboring block existing in the referencepicture. The reference picture including the reference block and thereference picture including the temporal neighboring block may also bethe same as each other, and may also be different from each other. Thetemporal neighboring block may be called the name such as a collocatedreference block, a collocated CU (colCU), or the like, and the referencepicture including the temporal neighboring block may also be called acollocated picture (colPic). For example, the inter predictor 221 mayconfigure a motion information candidate list based on the neighboringblocks, and generate information indicating what candidate is used toderive the motion vector and/or the reference picture index of thecurrent block. The inter prediction may be performed based on variousprediction modes, and for example, in the case of a skip mode and amerge mode, the inter predictor 221 may use the motion information ofthe neighboring block as the motion information of the current block. Inthe case of the skip mode, the residual signal may not be transmittedunlike the merge mode. A motion vector prediction (MVP) mode mayindicate the motion vector of the current block by using the motionvector of the neighboring block as a motion vector predictor, andsignaling a motion vector difference.

The predictor 220 may generate a prediction signal based on variousprediction methods to be described below. For example, the predictor mayapply intra prediction or inter prediction for prediction of one blockand may simultaneously apply intra prediction and inter prediction. Thismay be called combined inter and intra prediction (CIIP). In addition,the predictor may be based on an intra block copy (IBC) prediction modeor based on a palette mode for prediction of a block. The IBC predictionmode or the palette mode may be used for image/video coding of contentsuch as games, for example, screen content coding (SCC). IBC basicallyperforms prediction within the current picture, but may be performedsimilarly to inter prediction in that a reference block is derivedwithin the current picture. That is, IBC may use at least one of theinter prediction techniques described in this document. The palette modemay be viewed as an example of intra coding or intra prediction. Whenthe palette mode is applied, a sample value in the picture may besignaled based on information on the palette table and the paletteindex.

The prediction signal generated by the predictor (including the interpredictor 221 and/or the intra predictor 222) may be used to generate areconstructed signal or may be used to generate a residual signal. Thetransformer 232 may generate transform coefficients by applying atransform technique to the residual signal. For example, the transformtechnique may include at least one of a discrete cosine transform (DCT),a discrete sine transform (DST), a Karhunen-Loeve Transform (KLT), agraph-based transform (GBT), or a conditionally non-linear transform(CNT). Here, GBT refers to transformation obtained from a graph whenexpressing relationship information between pixels in the graph. CNTrefers to transformation obtained based on a prediction signal generatedusing all previously reconstructed pixels. Also, the transformationprocess may be applied to a block of pixels having the same size as asquare or may be applied to a block of a variable size that is not asquare.

The quantizer 233 quantizes the transform coefficients and transmits thesame to the entropy encoder 240, and the entropy encoder 240 encodes thequantized signal (information on the quantized transform coefficients)and outputs the encoded signal as a bitstream. Information on thequantized transform coefficients may be referred to as residualinformation. The quantizer 233 may rearrange the quantized transformcoefficients in the block form into a one-dimensional vector form basedon a coefficient scan order and may generate information on thetransform coefficients based on the quantized transform coefficients inthe one-dimensional vector form. The entropy encoder 240 may performvarious encoding methods such as, for example, exponential Golomb,context-adaptive variable length coding (CAVLC), and context-adaptivebinary arithmetic coding (CABAC). The entropy encoder 240 may encodeinformation necessary for video/image reconstruction (e.g., values ofsyntax elements, etc.) other than the quantized transform coefficientstogether or separately. Encoded information (e.g., encoded video/imageinformation) may be transmitted or stored in units of a networkabstraction layer (NAL) unit in the form of a bitstream. The video/imageinformation may further include information on various parameter sets,such as an adaptation parameter set (APS), a picture parameter set(PPS), a sequence parameter set (SPS), or a video parameter set (VPS).Also, the video/image information may further include general constraintinformation. In this document, information and/or syntax elementstransmitted/signaled from the encoding apparatus to the decodingapparatus may be included in video/image information. The video/imageinformation may be encoded through the encoding procedure describedabove and included in the bitstream. The bitstream may be transmittedthrough a network or may be stored in a digital storage medium. Here,the network may include a broadcasting network and/or a communicationnetwork, and the digital storage medium may include various storagemedia such as USB, SD, CD, DVD, Blu-ray, HDD, and SSD. A transmittingunit (not shown) and/or a storing unit (not shown) for transmitting orstoring a signal output from the entropy encoder 240 may be configuredas internal/external elements of the encoding apparatus 200, or thetransmitting unit may be included in the entropy encoder 240.

The quantized transform coefficients output from the quantizer 233 maybe used to generate a prediction signal. For example, the residualsignal (residual block or residual samples) may be reconstructed byapplying dequantization and inverse transform to the quantized transformcoefficients through the dequantizer 234 and the inverse transform unit235. The adder 250 may add the reconstructed residual signal to theprediction signal output from the inter predictor 221 or the intrapredictor 222 to generate a reconstructed signal (reconstructed picture,reconstructed block, reconstructed sample array). When there is noresidual for the processing target block, such as when the skip mode isapplied, the predicted block may be used as a reconstructed block. Theadder 250 may be referred to as a restoration unit or a restorationblock generator. The generated reconstructed signal may be used forintra prediction of a next processing target block in the currentpicture, or may be used for inter prediction of the next picture afterbeing filtered as described below.

Meanwhile, luma mapping with chroma scaling (LMCS) may be applied duringa picture encoding and/or reconstruction process.

The filter 260 may improve subjective/objective image quality byapplying filtering to the reconstructed signal. For example, the filter260 may generate a modified reconstructed picture by applying variousfiltering methods to the reconstructed picture, and store the modifiedreconstructed picture in the memory 270, specifically, in a DPB of thememory 270. The various filtering methods may include, for example,deblocking filtering, a sample adaptive offset, an adaptive loop filter,a bilateral filter, and the like. The filter 260 may generate variouskinds of information related to the filtering, and transfer thegenerated information to the entropy encoder 240 as described later inthe description of each filtering method. The information related to thefiltering may be encoded by the entropy encoder 240 and output in theform of a bitstream.

The modified reconstructed picture transmitted to the memory 270 may beused as a reference picture in the inter predictor 221. When the interprediction is applied through the encoding apparatus, predictionmismatch between the encoding apparatus 200 and the decoding apparatuscan be avoided and encoding efficiency can be improved.

The DPB of the memory 270 may store the modified reconstructed picturefor use as the reference picture in the inter predictor 221. The memory270 may store motion information of a block from which the motioninformation in the current picture is derived (or encoded) and/or motioninformation of blocks in the picture, having already been reconstructed.The stored motion information may be transferred to the inter predictor221 to be utilized as motion information of the spatial neighboringblock or motion information of the temporal neighboring block. Thememory 270 may store reconstructed samples of reconstructed blocks inthe current picture, and may transfer the reconstructed samples to theintra predictor 222.

Meanwhile, in this document, at least one of quantization/dequantizationand/or transform/inverse transform may be omitted. When thequantization/dequantization is omitted, the quantized transformcoefficient may be referred to as a transform coefficient. When thetransform/inverse transform is omitted, the transform coefficient may becalled a coefficient or a residual coefficient or may still be calledthe transform coefficient for uniformity of expression.

Further, in this document, the quantized transform coefficient and thetransform coefficient may be referred to as a transform coefficient anda scaled transform coefficient, respectively. In this case, the residualinformation may include information on transform coefficient(s), and theinformation on the transform coefficient(s) may be signaled throughresidual coding syntax. Transform coefficients may be derived based onthe residual information (or information on the transformcoefficient(s)), and scaled transform coefficients may be derivedthrough inverse transform (scaling) on the transform coefficients.Residual samples may be derived based on inverse transform (transform)of the scaled transform coefficients. This may be applied/expressed inother parts of this document as well.

FIG. 3 is a diagram for schematically explaining the configuration of avideo/image decoding apparatus to which the disclosure of the presentdocument may be applied.

Referring to FIG. 3 , the decoding apparatus 300 may include andconfigured with an entropy decoder 310, a residual processor 320, apredictor 330, an adder 340, a filter 350, and a memory 360. Thepredictor 330 may include an intra predictor 331 and an inter predictor332. The residual processor 320 may include a dequantizer 321 and aninverse transformer 322. The entropy decoder 310, the residual processor320, the predictor 330, the adder 340, and the filter 350, which havebeen described above, may be configured by one or more hardwarecomponents (e.g., decoder chipsets or processors) according to anembodiment. Further, the memory 360 may include a decoded picture buffer(DPB), and may be configured by a digital storage medium. The hardwarecomponent may further include the memory 360 as an internal/externalcomponent.

When the bitstream including the video/image information is input, thedecoding apparatus 300 may reconstruct the image in response to aprocess in which the video/image information is processed in theencoding apparatus illustrated in FIG. 2 . For example, the decodingapparatus 300 may derive the units/blocks based on block split-relatedinformation acquired from the bitstream. The decoding apparatus 300 mayperform decoding using the processing unit applied to the encodingapparatus. Therefore, the processing unit for the decoding may be, forexample, a coding unit, and the coding unit may be split according tothe quad-tree structure, the binary-tree structure, and/or theternary-tree structure from the coding tree unit or the maximum codingunit. One or more transform units may be derived from the coding unit.In addition, the reconstructed image signal decoded and output throughthe decoding apparatus 300 may be reproduced through a reproducingapparatus.

The decoding apparatus 300 may receive a signal output from the encodingapparatus of FIG. 2 in the form of a bitstream, and the received signalmay be decoded through the entropy decoder 310. For example, the entropydecoder 310 may parse the bitstream to derive information (e.g.,video/image information) necessary for image reconstruction (or picturereconstruction). The video/image information may further includeinformation on various parameter sets such as an adaptation parameterset (APS), a picture parameter set (PPS), a sequence parameter set(SPS), or a video parameter set (VPS). In addition, the video/imageinformation may further include general constraint information. Thedecoding apparatus may further decode picture based on the informationon the parameter set and/or the general constraint information.Signaled/received information and/or syntax elements described later inthis document may be decoded may decode the decoding procedure andobtained from the bitstream. For example, the entropy decoder 310decodes the information in the bitstream based on a coding method suchas exponential Golomb coding, context-adaptive variable length coding(CAVLC), or context-adaptive arithmetic coding (CABAC), and outputsyntax elements required for image reconstruction and quantized valuesof transform coefficients for residual. More specifically, the CABACentropy decoding method may receive a bin corresponding to each syntaxelement in the bitstream, determine a context model by using a decodingtarget syntax element information, decoding information of a decodingtarget block or information of a symbol/bin decoded in a previous stage,and perform an arithmetic decoding on the bin by predicting aprobability of occurrence of a bin according to the determined contextmodel, and generate a symbol corresponding to the value of each syntaxelement. In this case, the CABAC entropy decoding method may update thecontext model by using the information of the decoded symbol/bin for acontext model of a next symbol/bin after determining the context model.The information related to the prediction among the information decodedby the entropy decoder 310 may be provided to the the predictor (interpredictor 332 and intra predictor 331), and residual values on which theentropy decoding has been performed in the entropy decoder 310, that is,the quantized transform coefficients and related parameter information,may be input to the residual processor 320.

The dequantizer 321 may dequantize the quantized transform coefficientsto output the transform coefficients. The dequantizer 321 may rearrangethe quantized transform coefficients in a two-dimensional block form. Inthis case, the rearrangement may be performed based on a coefficientscan order performed by the encoding apparatus. The dequantizer 321 mayperform dequantization for the quantized transform coefficients using aquantization parameter (e.g., quantization step size information), andacquire the transform coefficients.

The inverse transformer 322 inversely transforms the transformcoefficients to acquire the residual signal (residual block, residualsample array).

The predictor 330 may perform the prediction of the current block, andgenerate a predicted block including the prediction samples of thecurrent block. The predictor may determine whether the intra predictionis applied or the inter prediction is applied to the current block basedon the information about prediction output from the entropy decoder 310,and determine a specific intra/inter prediction mode.

The predictor 330 may generate a prediction signal based on variousprediction methods to be described later. For example, the predictor mayapply intra prediction or inter prediction for prediction of one block,and may simultaneously apply intra prediction and inter prediction. Thismay be called combined inter and intra prediction (CIIP). In addition,the predictor may be based on an intra block copy (IBC) prediction modeor based on a palette mode for prediction of a block. The IBC predictionmode or the palette mode may be used for image/video coding of contentsuch as games, for example, screen content coding (SCC). IBC maybasically perform prediction within the current picture, but may beperformed similarly to inter prediction in that a reference block isderived within the current picture. That is, IBC may use at least one ofthe inter prediction techniques described in this document. The palettemode may be considered as an example of intra coding or intraprediction. When the palette mode is applied, information on the palettetable and the palette index may be included in the video/imageinformation and signaled.

The intra predictor 3321 may predict the current block by referring tothe samples in the current picture. The referred samples may be locatedin the neighborhood of the current block, or may be located apart fromthe current block according to the prediction mode. In intra prediction,prediction modes may include a plurality of non-directional modes and aplurality of directional modes. The intra predictor 331 may determinethe prediction mode to be applied to the current block by using theprediction mode applied to the neighboring block.

The inter predictor 332 may derive a predicted block for the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. In this case, in order to reducethe amount of motion information being transmitted in the interprediction mode, motion information may be predicted in the unit ofblocks, subblocks, or samples based on correlation of motion informationbetween the neighboring block and the current block. The motioninformation may include a motion vector and a reference picture index.The motion information may further include information on interprediction direction (L0 prediction, L1 prediction, Bi prediction, andthe like). In case of inter prediction, the neighboring block mayinclude a spatial neighboring block existing in the current picture anda temporal neighboring block existing in the reference picture. Forexample, the inter predictor 332 may construct a motion informationcandidate list based on neighboring blocks, and derive a motion vectorof the current block and/or a reference picture index based on thereceived candidate selection information. Inter prediction may beperformed based on various prediction modes, and the information on theprediction may include information indicating a mode of inter predictionfor the current block.

The adder 340 may generate a reconstructed signal (reconstructedpicture, reconstructed block, or reconstructed sample array) by addingthe obtained residual signal to the prediction signal (predicted blockor predicted sample array) output from the predictor (including interpredictor 332 and/or intra predictor 331). If there is no residual forthe processing target block, such as a case that a skip mode is applied,the predicted block may be used as the reconstructed block.

The adder 340 may be called a reconstructor or a reconstructed blockgenerator. The generated reconstructed signal may be used for the intraprediction of a next block to be processed in the current picture, andas described later, may also be output through filtering or may also beused for the inter prediction of a next picture.

Meanwhile, a luma mapping with chroma scaling (LMCS) may also be appliedin the picture decoding process.

The filter 350 may improve subjective/objective image quality byapplying filtering to the reconstructed signal. For example, the filter350 may generate a modified reconstructed picture by applying variousfiltering methods to the reconstructed picture, and store the modifiedreconstructed picture in the memory 360, specifically, in a DPB of thememory 360. The various filtering methods may include, for example,deblocking filtering, a sample adaptive offset, an adaptive loop filter,a bilateral filter, and the like.

The (modified) reconstructed picture stored in the DPB of the memory 360may be used as a reference picture in the inter predictor 332. Thememory 360 may store the motion information of the block from which themotion information in the current picture is derived (or decoded) and/orthe motion information of the blocks in the picture having already beenreconstructed. The stored motion information may be transferred to theinter predictor 332 so as to be utilized as the motion information ofthe spatial neighboring block or the motion information of the temporalneighboring block. The memory 360 may store reconstructed samples ofreconstructed blocks in the current picture, and transfer thereconstructed samples to the intra predictor 331.

In this disclosure, the embodiments described in the filter 260, theinter predictor 221, and the intra predictor 222 of the encodingapparatus 200 may be applied equally or to correspond to the filter 350,the inter predictor 332, and the intra predictor 331.

Meanwhile, as described above, in performing video coding, prediction isperformed to improve compression efficiency. Through this, a predictedblock including prediction samples for a current block as a block to becoded (i.e., a coding target block) may be generated. Here, thepredicted block includes prediction samples in a spatial domain (orpixel domain). The predicted block is derived in the same manner in anencoding apparatus and a decoding apparatus, and the encoding apparatusmay signal information (residual information) on residual between theoriginal block and the predicted block, rather than an original samplevalue of an original block, to the decoding apparatus, therebyincreasing image coding efficiency. The decoding apparatus may derive aresidual block including residual samples based on the residualinformation, add the residual block and the predicted block to generatereconstructed blocks including reconstructed samples, and generate areconstructed picture including the reconstructed blocks.

The residual information may be generated through a transform andquantization procedure. For example, the encoding apparatus may derive aresidual block between the original block and the predicted block,perform a transform procedure on residual samples (residual samplearray) included in the residual block to derive transform coefficients,perform a quantization procedure on the transform coefficients to derivequantized transform coefficients, and signal related residualinformation to the decoding apparatus (through a bit stream). Here, theresidual information may include value information of the quantizedtransform coefficients, location information, a transform technique, atransform kernel, a quantization parameter, and the like. The decodingapparatus may perform dequantization/inverse transform procedure basedon the residual information and derive residual samples (or residualblocks). The decoding apparatus may generate a reconstructed picturebased on the predicted block and the residual block. Also, for referencefor inter prediction of a picture afterward, the encoding apparatus mayalso dequantize/inverse-transform the quantized transform coefficientsto derive a residual block and generate a reconstructed picture basedthereon.

Meanwhile, various inter prediction modes may be used for prediction ofa current block within a picture. For example, various modes such asmerge mode, skip mode, motion vector prediction (MVP) mode, affine mode,subblock merge mode, merge with MVD (MMVD) mode, etc. Decoder sidemotion vector refinement (DMVR) mode, adaptive motion vector resolution(AMVR) mode, bi-prediction with CU-level weight (BCW), bi-directionaloptical flow (BDOF), etc. may be used in addition or instead asancillary modes. The affine mode may be referred to as an affine motionprediction mode. The MVP mode may be referred to as an advanced motionvector prediction (AMVP) mode. In the present disclosure, some modesand/or motion information candidates derived by some modes may beincluded as one of motion information-related candidates of other modes.For example, the HMVP candidate may be added as a merge candidate of themerge/skip mode, or may be added as an mvp candidate of the MVP mode.

The inter prediction mode information indicating the inter predictionmode of the current block may be signaled from the encoding apparatus tothe decoding apparatus. The inter prediction mode information may beincluded in a bitstream and received at the decoding apparatus. Theinter prediction mode information may include index informationindicating one of multiple candidate modes. Further, the interprediction mode may be indicated through hierarchical signaling of flaginformation. In this case, the inter prediction mode information mayinclude one or more flags. For example, it may be indicated whether theskip mode is applied by signaling the skip flag; it may be indicatedwhether the merge mode is applied by signaling the merge flag for theskip mode not being applied; and it may be indicated that the MVP modeis applied or a flag for further partition may be further signaled whenthe merge mode is not applied. The affine mode may be signaled as anindependent mode, or may be signaled as a mode dependent on the mergemode, the MVP mode or the like. For example, the affine mode may includean affine merge mode and an affine MVP mode.

Meanwhile, information indicating whether or not the list0 (L0)prediction, list1 (L1) prediction, or bi-prediction described above isused in the current block (current coding unit) may be signaled to thecurrent block. Said information may be referred to as motion predictiondirection information, inter prediction direction information, or interprediction indication information, and may beconstructed/encoded/signaled in the form of, for example, aninter_pred_idc syntax element. That is, the inter_pred_idc syntaxelement may indicate whether or not the above-described list0 (L0)prediction, list1(L1) prediction, or bi-prediction is used for thecurrent block (current coding unit). In the present disclosure, forconvenience of description, the inter prediction type (L0 prediction, L1prediction, or BI prediction) indicated by the inter_pred_idc syntaxelement may be represented as a motion prediction direction. L0prediction may be represented by pred_L0; L1 prediction may berepresented by pred_L1; and bi-prediction may be represented by pred_BI.For example, the following prediction type may be indicated according tothe value of the inter_pred_idc syntax element.

As described above, one picture may include one or more slices. A slicemay have one of the slice types including intra (I) slice, predictive(P) slice, and bi-predictive (B) slice. The slice type may be indicatedbased on slice type information. For blocks in I slice, inter predictionis not used for prediction, and only intra prediction may be used. Ofcourse, even in this case, the original sample value may be coded andsignaled without prediction. For blocks in P slice, intra prediction orinter prediction may be used, and when inter prediction is used, onlyuni prediction may be used. Meanwhile, intra prediction or interprediction may be used for blocks in B slice, and when inter predictionis used, up to the maximum bi-prediction may be used.

L0 and L1 may include reference pictures encoded/decoded before thecurrent picture. For example, L0 may include reference pictures beforeand/or after the current picture in POC order, and L1 may includereference pictures after and/or before the current picture in POC order.In this case, a reference picture index lower relative to referencepictures earlier than the current picture in POC order may be allocatedto L0, and a reference picture index lower relative to referencepictures later than the current picture in POC order may be allocated toL1. In the case of B slice, bi-prediction may be applied, and in thiscase, unidirectional bi-prediction may be applied, or bi-directionalbi-prediction may be applied. Bi-directional bi-prediction may bereferred to as true bi-prediction.

For example, information on the inter prediction mode of the currentblock may be coded and signaled at a CU (CU syntax) level or the like,or may be implicitly determined according to a condition. In this case,some modes may be explicitly signaled, and other modes may be implicitlyderived.

For example, the CU syntax may carry information on the (inter)prediction mode, etc. The CU syntax may be as shown in Table 1 below.

TABLE 1 Descriptor coding_unit( x0, y0, cbWidth, cbHeight, treeType ) { if( slice_type != I | | sps_ibc_enabled_flag ) {   if( treeType !=DUAL_TREE_CHROMA &&    !( cbWidth = = 4 && cbHeight = = 4 &&   !sps_ibc_enabled_flag ) )     cu_skip_flag[ x0 ][ y0 ] ae(v)   if(cu_skip_flag[ x0 ][ y0 ] = = 0 && slice_type != I    && !( cbWidth = = 4&& cbHeight = = 4 ) )     pred_mode_flag ae(v)   if( ( ( slice_type = =I && cu_skip_   flag[ x0 ][ y0 ] = =0 ) | |     ( slice_type != I && (CuPredMode     [ x0 ][ y0 ] != MODE INTRA | |     ( cbWidth = = 4 &&cbHeight = =     4 && cu_skip_flag[ x0 ][ y0 ] = = 0 ) ) ) ) &&    sps_ibc_enabled_flag && ( cbWidth !=     128 | | cbHeight != 128 ) )    pred_mode_ibc_flag ae(v)  }  if( CuPredMode[ x0 ][ y0 ] = =MODE_INTRA ) {   if( sps_pcm_enabled_flag &&     cbWidth >=MinIpcmCbSizeY &&     cbWidth <= MaxIpcmCbSizeY &&     cbHeight >=MinIpcmCbSizeY &&     cbHeight <= MaxIpcmCbSizeY )     pcm_flag[ x0 ][y0 ] ae(v)   if( pcm_flag[ x0 ][ y0 ] ) {     while( !byte_aligned( ) )     pcm_alignment_zero_bit f(1)     pcm_sample( cbWidth, cbHeight,treeType)   } else {         if( treeType = = SINGLE_TREE | |        treeType = = DUAL_TREE_LUMA ) {          if( cbWidth <= 32 &&         cbHeight <= 32 )           intra_bdpcm_flag[ x0 ][ y0 ] ae(v)         if( intra_bdpcm_flag[ x0 ][ y0 ] )          intra_bdpcm_dir_flag[ x0 ][ y0 ] ae(v)          else {          if( sps_mip_enabled_flag &&            ( Abs( Log2( cbWidth )−            Log2( cbHeight ) ) <= 2 ) &&             cbWidth <=MaxTbSizeY &&             cbHeight <= MaxTbSizeY )           intra_mip_flag[ x0 ][ y0 ] ae(v)           if(intra_mip_flag[ x0 ][ y0 ] ) {             intra_mip_mpm_ ae(v)            flag[ x0 ][ y0 ]            if( intra_mip_mpm_flag           [ x0 ][ y0 ] )             intra_mip_mpm_ ae(v)            idx[ x0 ][ y0 ]            else             intra_mip_mpm_ae(v)             remainder[ x0 ][ y0 ]           } else {           if( sps_mrl_enabled_flag            && ( ( y0 % CtbSizeY ) >0 ) )             intra_luma_ref_ ae(v)             idx[ x0 ][ y0 ]           if ( sps_isp_enabled_flag &&            intra_luma_ref_idx           [ x0 ][ y0 ] = = 0 &             ( cbWidth <= MaxTbSizeY            && cbHeight <=             MaxTbSizeY ) &&             (cbWidth * cbHeight >             MinTbSizeY *             MinTbSizeY ) )            intra_subpartitions_mode_ ae(v)             flag[ x0 ][ y0 ]           if( intra_subpartitions_mode_             flag[ x0 ][ y0 ] == 1 &&             cbWidth <=             MaxTbSizeY &&            cbHeight <= MaxTbSizeY )            intra_subpartitions_split_ ae(v)             flag[ x0 ][ y0]            if( intra_luma_ref_idx            [ x0 ][ y0 ] = = 0 &&            intra_subpartitions_mode_             flag[ x0 ][ y0 ] = = 0)             intra_luma_mpm_flag ae(v)             [ x0 ][ y0 ]           if( intra_luma_mpm_flag            [ x0 ][ y0 ] ) {            if( intra_luma_ref_idx             [ x0 ][ y0 ] = = 0 )             intra_luma_not_planar_ ae(v)              flag[ x0 ][ y0 ]            if( intra_luma_not_planar_             flag[ x0 ][ y0 ] )             intra_luma_mpm_idx ae(v)              [ x0 ][ y0 ]           } else             intra_luma_mpm_ ae(v)            remainder[ x0 ][ y0 ]           }          }         }        if( treeType = = SINGLE_TREE | |         treeType = = DUAL_        TREE_CHROMA )          intra_chroma_pred_mode[ x0 ][ y0 ] ae(v)       }       } else if( treeType !=       DUAL_TREE_CHROMA )       {/* MODE_INTER or MODE_IBC */        if( cu_skip_flag[ x0 ][ y0 ] = = 0 )        general_merge_flag[ x0 ][ y0 ] ae(v)        if(general_merge_flag[ x0 ][ y0 ] ) {         merge_data( x0, y0,        cbWidth, cbHeight )        } else if ( CuPredMode[ x0 ][ y0 ] ==        MODE_IBC ) {         mvd_coding( x0, y0, 0, 0 )        mvp_l0_flag[ x0 ][ y0 ] ae(v)         if( sps_amvr_enabled_flag&&          ( Mvd0[ x0 ][ y0 ][ 0 ] !=0 | |          MvdL0[ x0 ][ y0 ][1 ] = = 0 ) ) {          amvr_precision_flag[ x0 ][ y0 ] ae(v)         }       } else {         if( slice_type = = B )          inter_pred_idc[x0 ][ y0 ] ae(v)         if( sps_affine_enabled_flag &&        cbWidth >= 16 &&         cbHeight >= 16 ) {         inter_affine_flag[ x0 ][ y0 ] ae(v)          if(sps_affine_type_flag &&          inter_affine_flag[ x0 ][ y0 ] )          cu_affine_type_flag[ x0 ][ y0 ] ae(v)         }         if(sps_smvd_enabled_flag &&         inter_pred_idc[ x0 ][ y0 ] = =        PRED_BI &&          !inter_affine_flag[ x0 ][ y0 ] &&RefIdxSymL0 > −1 && RefIdxSymL1 > −1 )          sym_mvd_flag[ x0 ][ y0 ]ae(v)         if( inter_pred_idc[ x0 ][ y0 ] !=          PRED_L1 ) {         if( NumRefIdxActive[ 0 ] > 1 &&          !sym_mvd_flag[ x0 ][y0 ] )           ref_ idx_l0[ x0 ][ y0 ] ae(v)          mvd_coding( x0,y0, 0, 0 )          if( MotionModelIdc[ x0 ][ y0 ] > 0 )          mvd_coding( x0, y0, 0, 1 )          if(MotionModelIdc[ x0 ][y0 ] > 1 )           mvd_coding( x0, y0, 0, 2 )          mvp_l0_flag[ x0][ y0 ] ae(v)         } else {          MvdL0[ x0 ][ y0 ][ 0 ] = 0         MvdL0[ x0 ][ y0 ][ 1 ] = 0         }         if(inter_pred_idc[ x0 ][ y0 ]         != PRED_L0 ) {          if(NumRefIdxActive[ 1 ] > 1 &&          !sym_mvd_flag[ x0 ][ y0 ] )          ref_idx_l1[ x0 ][ y0 ] ae(v)          if( mvd_l1_zero_flag &&         inter_pred_idc[ x0 ][ y0 ] = =          PRED_BI ) {          MvdL1[ x0 ][ y0 ][ 0 ] = 0           MvdL1[ x0 ][ y0 ][ 1 ] =0           MvdCpL1[ x0 ][ y0 ][ 0 ][ 0 ] = 0           MvdCpL1[ x0 ][y0 ][ 0 ][ 1 ] = 0           MvdCpL1[ x0 ][ y0 ][ 1 ][ 0 ] = 0          MvdCpL1[ x0 ][ y0 ][ 1 ][ 1 ] = 0           MvdCpL1[ x0 ][ y0][ 2 ][ 0 ] = 0           MvdCpL1[ x0 ][ y0 ][ 2 ][ 1 ] = 0          }else {           if( sym_mvd_flag[ x0 ][ y0 ] ) {           } else           mvd_coding( x0, y0, 1, 0 )           if( MotionModelIdc          [ x0 ][ y0 ] > 0 )            mvd_coding( x0, y0, 1, 1)          if(MotionModelIdc           [ x0 ][ y0 ] > 1 )           mvd_coding( x0, y0, 1, 2 )           mvp_l1_flag[ x0 ][ y0 ]ae(v)          }         } else {          MvdL1[ x0 ][ y0 ][ 0 ] = 0         MvdL1[ x0 ][ y0 ][ 1 ] = 0         }         if( (sps_amvr_enabled_flag &&         inter_affine_flag[ x0 ][ y0 ] = = 0 &&          ( MvdL0[ x0 ][ y0 ][ 0 ] !=           0 | | MvdL0[ x0 ][ y0 ][1 ] != 0 | |            MvdL1[ x0 ][ y0 ][ 0 ] !=           0 | | MvdL1[x0 ][ y0 ]           [ 1 ] != 0 ) ) | |           (sps_affine_amvr_enabled_flag           && inter_affine_flag           [x0 ][ y0 ] = = 1      &&            ( MvdCpL0[ x0 ][ y0 ]            [ 0][ 0 ] != 0            | | MvdCpL0[ x0 ][ y0 ]            [ 0 ][ 1 ] !=0 | |            MvdCpL1[ x0 ][ y0 ]            [ 0 ][ 0 ] != 0           | | MvdCpL1[ x0 ][ y0 ]            [ 0 ][ 1 ] != 0 | |           MvdCpL0[ x0 ][ y0 ]            [ 1 ][ 0 ] != 0            | |MvdCpL0[ x0 ][ y0 ]            [ 1 ][ 1 ] != 0 | |            MvdCpL1[x0 ][ y0 ]            [ 1 ][ 0 ] != 0            | | MvdCpL1[ x0 ][ y0 ]           [ 2 ][ 1 ] != 0 | |            MvdCpL0[ x0 ][ y0 ]           [ 2 ][ 0 ] != 0            | | MvdCpL0[ x0 ][ y0 ]           [ 2 ][ 1 ] != 0 | |            MvdCpL1[ x0 ][ y0 ]           [ 2 ][ 0 ] != 0            | | MvdCpL1[ x0 ][ y0 ] [ 2 ][ 1 ]!= 0 ) ) {          amvr_flag[ x0 ][ y0 ] ae(v)          if( amvr_flag[x0 ][ y0 ] )           amvr_precision_flag[ x0 ][ y0 ] ae(v)         }        If( sps_bcw_enabled_flag &&         inter_pred_idc[ x0 ][ y0 ] ==         PRED_BI &&           luma_weight_l0_flag           [ref_idx_l0 [ x0 ][ y0 ] ] = = 0 &&           luma_weight_l1_flag          [ ref_idx_l1 [ x0 ][ y0 ] ] = = 0 &&          chroma_weight_l0_flag           [ ref_idx_l0 [ x0 ][ y0 ] ] == 0 &&           chroma_weight_l1_flag           [ ref_idx_l1 [ x0 ][ y0] ] = = 0 &&           cbWidth * cbHeight >= 256 )          bcw_idx[ x0][ y0 ] ae(v)        }       }       if( !pcm_flag[ x0 ][ y0 ] ) {       if( CuPredMode[ x0 ][ y0 ] !=        MODE_INTRA &&        general_merge_flag[ x0 ][ y0 ] = = 0 )         cu_cbf ae(v)       if( cu_cbf ) {         if( CuPredMode[ x0 ][ y0 ] = =        MODE_INTER &&         sps_sbt_enabled_flag          !ciip_flag[x0 ][ y0 ] &&          !MergeTriangleFlag[ x0 ][ y0 ] ) {          if(cbWidth <= MaxSbtSize &&          cbHeight <= MaxSbtSize ) {          allowSbtVerH = cbWidth >= 8           allowSbtVerQ =cbWidth >= 16           allowSbtforH = cbHeight >= 8          allowSbtHorQ = cbHeight >= 16           if( allowSbtVerH | |          allowSbtHorH | | allowSbtVerQ | |      allowSbtHorQ )           cu_sbt_flag ae(v)          }          if( cu_sbt_flag ) {          if( ( allowSbtVerH | |           allowSbtHorH ) &&      (allowSbtVerQ | | allowSbtHorQ) )            cu_sbt_quad_flag ae(v)          if( ( cu_sbt_quad_flag &&           allowSbtVerQ &&          allowSbtHorQ ) | |             ( !cu_sbt_quad_flag &&            allowSbtVerH &&             allowSbtHorH ) )           cu_sbt_horizontal_flag ae(v)           cu_sbt_pos_flag ae(v)         }         }         numSigCoeff = 0         numZeroOutSigCoeff= 0         transform_tree( x0, y0,         cbWidth, cbHeight, treeType)         lfnstWidth = ( treeType = = DUAL_ TREE_CHROMA ) ? cbWidth /SubWidthC : cbWidth         lfnstHeight = ( treeType = =DUAL_TREE_CHROMA) ? cbHeight /             SubHeightC : cbHeight        if( Min( lfnstWidth,         lfnstHeight ) >= 4 &&        sps_lfnst_enabled_flag = = 1 &&          CuPredMode[ x0 ][ y0 ]= =          MODE_INTRA &&          IntraSubPartitionsSplitType = =         ISP_NO_SPLIT &&          !intra_mip_flag[ x0 ][ y0 ] ) {         if( ( numSigCoeff > ( ( treeType = =          SINGLE_TREE ) ? 2: 1 ) ) &&            numZeroOutSigCoeff = = 0 )           lfnst_idx[ x0][ y0 ] ae(v)         }        }       }      }

In Table 1, cu_skip_flag may indicate whether skip mode is applied tothe current block (CU).

pred_mode_flag equal to 0 may specify that the current coding unit iscoded in inter prediction mode. Pred_mode_flag equal to 1 may specifythat the current coding unit is coded in intra prediction mode.

pred_mode_ibc_flag equal to 1 may specify that the current coding unitis coded in IBC prediction mode. Pred_mode_ibc_flag equal to 0 mayspecify that the current coding unit is not coded in IBC predictionmode.

pcm_flag[x0][y0] equal to 1 may specify that the pcm_sample( ) syntaxstructure is present and the transform_tree( ) syntax structure is notpresent in the coding unit including the luma coding block at thelocation (x0, y0). Pcm_flag[x0][y0] equal to 0 may specify thatpcm_sample( ) syntax structure is not present. That is, pcm_flag mayrepresent whether a pulse coding modulation (PCM) mode is applied to thecurrent block. If PCM mode is applied to the current block, prediction,transformation, quantization, etc. Are not applied, and values of theoriginal sample in the current block may be coded and signaled.

intra_mip_flag[x0][y0] equal to 1 may specify that the intra predictiontype for luma samples is matrix-based intra prediction (MIP).Intra_mip_flag[x0][y0] equal to 0 may specify that the intra predictiontype for luma samples is not matrix-based intra prediction. That is,intra_mip_flag may represent whether an MIP prediction mode (type) isapplied to (a luma sample of) the current block.

intra_chroma_pred_mode[x0][y0] may specify the intra prediction mode forchroma samples in the current block.

general_merge_flag[x0][y0] may specify whether the inter predictionparameters for the current coding unit are inferred from a neighbouringinter-predicted partition. That is, general_merge_flag may representthat general merge is available, and when the value ofgeneral_merge_flag is 1, regular merge mode, mmvd mode, and mergesubblock mode (subblock merge mode) may be available. For example, whenthe value of general_merge_flag is 1, merge data syntax may be parsedfrom encoded video/image information (or bitstream), and the merge datasyntax configured/coded to include information as shown in Table 2below.

TABLE 2 Descriptor merge_data( x0, y0, cbWidth, cbHeight ) {  if (CuPredMode[ x0 ][ y0 ] = = MODE_IBC ) {   if( MaxNumMergeCand > 1 )   merge_idx[ x0 ][ y0 ] ae(v)  } else {   if( sps_mmvd_enabled_flag | |  cbWidth * cbHeight != 32 )    regular_merge_flag[ x0 ][ y0 ] ae(v)  if ( regular_merge_flag[ x0 ][ y0 ] = = 1 ){    if( MaxNumMergeCand >1 )     merge_idx[ x0 ][ y0 ] ae(v)   } else {    if(sps_mmvd_enabled_flag &&    cbWidth * cbHeight != 32 )    mmvd_merge_flag[ x0 ][ y0 ] ae(v)    if( mmvd_merge_flag[ x0 ][ y0 ]= = 1 ) {     if( MaxNumMergeCand > 1 )      mmvd_cand_flag[ x0 ][ y0 ]ae(v)     mmvd_distance_idx[ x0 ][ y0 ] ae(v)     mmvd_direction_idx[ x0][ y0 ] ae(v)    } else {     if( MaxNumSubblockMergeCand > 0 &&cbWidth >= 8 && cbHeight >= 8 )      merge_subblock_flag[ x0 ][ y0 ]ae(v)         if( merge_subblock_         flag[ x0 ][ y0 ] = =         1) {          if( MaxNumSubblock-          MergeCand > 1 )          merge_subblock_ ae(v)           idx[ x0 ][ y0 ]         } else{          if( sps_ciip_enabled_flag &&          cu_skip_flag          [x0 ][ y0 ] = = 0 &&           ( cbWidth * cbHeight ) >=           64 &&          cbWidth < 128 &&           cbHeight < 128 )    {          ciip_flag[ x0 ][ y0 ] ae(v)          if( ciip_flag[ x0 ][ y0 ]&&          MaxNumMergeCand > 1 )           merge_idx[ x0 ][ y0 ] ae(v)         }          if( MergeTriangleFlag          [ x0 ][ y0 ] ) {          merge_triangle_ ae(v)           split_dir[ x0 ][ y0 ]          merge_triangle_ ae(v)           idx0[ x0 ][ y0 ]          merge_triangle_ ae(v)           idx1[ x0 ][ y0 ]          }        }        }       }      }     }

In Table 2, regular_merge_flag[x0][y0] equal to 1 may specify thatregular merge mode is used to generate the inter prediction parametersof the current coding unit. That is, regular_merge_flag may representwhether the merge mode (regular merge mode) is applied to the currentblock.

mmvd_merge_flag[x0][y0] equal to 1 may specify that merge mode withmotion vector difference is used to generate an inter predictionparameter of a current block. That is, mmvd_merge_flag representswhether MMVD is applied to the current block.

mmvd_cand_flag[x0][y0] may specify whether the first (0) or the second(1) candidate in the merging candidate list is used with the motionvector difference derived from mmvd_distance_idx[x0][y0] andmmvd_direction_idx[x0][y0].

mmvd_distance_idx[x0][y0] may specify the index used to deriveMmvdDistance[x0] [y0].

mmvd_direction_idx[x0][y0] may specify index used to deriveMmvdSign[x0][y0].

merge_subblock_flag[x0][y0] may specify the subblock-based interprediction parameters for the current block. That is,merge_subblock_flag may represents whether a subblock merge mode (oraffine merge mode) is applied to the current block.

merge_subblock_idx[x0] [y0] may specify the merging candidate index ofthe subblock-based merging candidate list.

ciip_flag[x0][y0] may specify whether the combined inter-picture mergeand intra-picture prediction (CIIP) is applied for the current codingunit.

merge_triangle_idx0[x0][y0] may specify a first merging candidate indexof the triangular shape based motion compensation candidate list.

merge_triangle_idx1[x0][y0] may specify a second merging candidate indexof the triangular shape based motion compensation candidate list.

merge_idx[x0][y0] may specify the merging candidate index of the mergingcandidate list.

Meanwhile, referring back to the CU syntax, mvp_l0_flag[x0][y0] mayspecify the motion vector predictor index of list 0. That is, when theMVP mode is applied, mvp_l0_flag may represent a candidate selected forMVP derivation of the current block from the MVP candidate list 0.

ref_idx_l1[x0][y0] has the same semantics as ref_idx_l0, with l0 andlist 0 may be replaced by l1 and list 1, respectively.

inter_pred_idc[x0][y0] may specify whether list0, list1, orbi-prediction is used for the current coding unit.

sym_mvd_flag[x0][y0] equal to 1 may specify that the syntax elementsref_idx_l0[x0][y0] and ref_idx_l1[x0][y0], and the mvd_coding(x0, y0,refList,cpIdx) syntax structure for refList equal to 1 are not present.That is, sym_mvd_flag represents whether symmetric MVD is used in mvdcoding.

ref_idx_l0[x0][y0] may specify the list 0 reference picture index forthe current block.

ref_idx_l1[x0][y0] has the same semantics as ref_idx_l0, with l0, L0 andlist 0 replaced by l1, L1 and list 1, respectively.

inter_affine_flag[x0][y0] equal to 1 may specify that affine model-basedmotion compensation is used to generate prediction samples of thecurrent block when decoding a P or B slice.

cu_affine_type_flag[x0][y0] equal to 1 may specify that for the currentcoding unit, when decoding a P or B slice, 6-parameter affine modelbased motion compensation is used to generate the prediction samples ofthe current coding unit. Cu_affine_type_flag[x0][y0] equal to 0 mayspecify that 4-parameter affine model based motion compensation is usedto generate the prediction samples of the current block.

amvr_flag[x0][y0] may specify the resolution of motion vectordifference. The array indices x0, y0 specify the location (x0, y0) ofthe top-left luma sample of the considered coding block relative to thetop-left luma sample of the picture. Amvr_flag[x0][y0] equal to 0 mayspecify that the resolution of the motion vector difference is ¼ of aluma sample. Amvr_flag[x0][y0] equal to 1 may specify that theresolution of the motion vector difference is further specified byamvr_precision_flag[x0][y0].

amvr_precision_flag[x0][y0] equal to 0 may specify that the resolutionof the motion vector difference is one integer luma sample ifinter_affine_flag[x0][y0] is equal to 0, and 1/16 of a luma sampleotherwise. Amvr_precision_flag[x0][y0] equal to 1 may specify that theresolution of the motion vector difference is four luma samples ifinter_affine_flag[x0][y0] is equal to 0, and one integer luma sampleotherwise.

bcw_idx[x0][y0] may specify the weight index of bi-prediction with CUweights.

FIG. 4 shows an example of a video/image encoding method based on interprediction, and FIG. 5 is an example schematically showing an interpredictor in an encoding apparatus. The inter predictor in the encodingapparatus of FIG. 5 may be applied to be the same as or correspond tothe inter predictor 221 of the encoding apparatus 200 of FIG. 2described above.

Referring to FIGS. 4 and 5 , the encoding apparatus performs interprediction on the current block (S400). The encoding apparatus mayderive the inter prediction mode and motion information of the currentblock, and generate prediction samples of the current block. Here, theprocedures for determining the inter prediction mode, deriving motioninformation, and generating prediction samples may be performedsimultaneously, or one procedure may be performed before anotherprocedure.

For example, the inter predictor 221 of the encoding apparatus mayinclude a prediction mode determiner 2211, a motion information deriver221_2, and a prediction sample deriver 2213, and the prediction modedeterminer 221_1 may determine the prediction mode for the currentblock, the motion information deriver 2212 may derive the motioninformation of the current block, and the prediction sample deriver 2213may derive the prediction samples of the current block. For example, theinter predictor 221 of the encoding apparatus may search for a blocksimilar to the current block within a predetermined area (search area)of reference pictures through motion estimation, and may derive areference block in which a difference from the current block is minimalor a predetermined reference or less. Based on this, a reference pictureindex indicating a reference picture in which the reference block islocated may be derived, and a motion vector may be derived based on aposition difference between the reference block and the current block.The encoding apparatus may determine a mode applied to the current blockfrom among various prediction modes. The encoding apparatus may comparerate-distortion (RD) costs for the various prediction modes anddetermine an optimal prediction mode for the current block

For example, when a skip mode or a merge mode is applied to the currentblock, the encoding apparatus may construct a merge candidate list to bedescribed later and derive a reference block in which a difference fromthe current block is minimal or a predetermined reference or less, amongreference blocks indicated by merge candidates included in the mergecandidate list. In this case, a merge candidate associated with thederived reference block may be selected, and merge index informationindicating the selected merge candidate may be generated and signaled tothe decoding apparatus. The motion information of the current block maybe derived using the motion information of the selected merge candidate.

As another example, when the (A)MVP mode is applied to the currentblock, the encoding apparatus constructs an (A)MVP candidate list to bedescribed later, and use a motion vector of a selected mvp candidate,among motion vector predictor (mvp) candidates included in the (A)MVPcandidate list, as an mvp of the current block. In this case, forexample, a motion vector indicating a reference block derived by themotion estimation described above may be used as the motion vector ofthe current block, and an mvp candidate having a motion vector havingthe smallest difference from the motion vector of the current block,among the mvp candidates, may be the selected mvp candidate. A motionvector difference (MVD) that is a difference obtained by subtracting themvp from the motion vector of the current block may be derived. In thiscase, information on the MVD may be signaled to the decoding apparatus.In addition, when the (A)MVP mode is applied, the value of the referencepicture index may be configured as reference picture index informationand separately signaled to the decoding apparatus.

The encoding apparatus may derive residual samples based on theprediction samples (S410). The encoding apparatus may derive theresidual samples by comparing the original samples of the current blockwith the prediction samples.

The encoding apparatus encodes image information including predictioninformation and residual information (S420). The encoding apparatus mayoutput the encoded image information in the form of a bitstream. Theprediction information is information related to the predictionprocedure, and may include prediction mode information (e.g., skip flag,merge flag, or mode index, etc.) and motion information. The informationon the motion information may include candidate selection information(e.g., merge index) that is information for deriving a motion vector. Inaddition, the information on the motion information may includeinformation indicating whether L0 prediction, L1 prediction, orbi-prediction is applied. The residual information is information on theresidual samples. The residual information may include information onquantized transform coefficients for the residual samples.

The output bitstream may be stored in a (digital) storage medium andtransmitted to the decoding apparatus or may be transmitted to thedecoding apparatus through a network

Also, as described above, the encoding apparatus may generate areconstructed picture (including reconstructed samples and reconstructedblocks) based on the reference samples and the residual samples. This isbecause the encoding apparatus may derive the same prediction result asthat performed by the decoding apparatus, and through this, codingefficiency may be increased. Accordingly, the encoding apparatus maystore the reconstructed picture (or reconstructed samples, reconstructedblock) in a memory and use the reconstructed picture as a referencepicture for inter prediction. As described above, an in-loop filteringprocedure may be further applied to the reconstructed picture.

FIG. 6 shows an example of a video/image decoding method based on interprediction, and FIG. 7 is an example schematically showing an interpredictor in a decoding apparatus. The inter predictor in the decodingapparatus of FIG. 7 may be applied equally or correspond to the interpredictor 332 of the decoding apparatus 300 of FIG. 3 described above.

Referring to FIGS. 6 and 7 , the decoding apparatus may perform anoperation corresponding to the operation performed by the encodingapparatus. The decoding apparatus may perform prediction on the currentblock based on the received prediction information and derive predictionsamples.

Specifically, the decoding apparatus may determine a prediction mode forthe current block based on the received prediction information (S600).The decoding apparatus may determine which inter prediction mode is tobe applied to the current block based on prediction mode information inthe prediction information

The inter prediction mode candidates may include skip mode, merge mode,and/or (A)MVP mode, or may include various inter prediction modes to bedescribed later.

The decoding apparatus derives motion information of the current blockbased on the determined inter prediction mode. For example, when theskip mode or the merge mode is applied to the current block, thedecoding apparatus may configure a merge candidate list and select onemerge candidate from among the merge candidates included in the mergecandidate list. The selection may be performed based on theaforementioned selection information (merge index). Motion informationof the current block may be derived using the motion information of theselected merge candidate. The motion information of the selected mergecandidate may be used as the motion information of the current block.

As another example, when the (A)MVP mode is applied to the currentblock, the decoding apparatus may construct an (A)MVP candidate list anduse a motion vector of a selected mvp candidate, among motion vectorpredictor (mvp) candidates included in the (A)MVP candidate list, as themvp of the current block. The selection may be performed based on theselection information (mvp flag or mvp index) described above. In thiscase, the MVD of the current block may be derived based on theinformation on the MVD, and a motion vector of the current block may bederived based on the mvp of the current block and the MVD. Also, thereference picture index of the current block may be derived based on thereference picture index information. A picture indicated by thereference picture index in the reference picture list for the currentblock may be derived as a reference picture referenced for interprediction of the current block.

Meanwhile, as will be described later, the motion information of thecurrent block may be derived without configuring a candidate list. Inthis case, the motion information of the current block may be derivedaccording to a procedure disclosed in a prediction mode to be describedlater. In this case, the configuration of the candidate list asdescribed above may be omitted.

The decoding apparatus may generate prediction samples for the currentblock based on the motion information of the current block (S620). Inthis case, the reference picture may be derived based on the referencepicture index of the current block, and the prediction samples of thecurrent block may be derived using samples of the reference blockindicated by the motion vector of the current block on the referencepicture. In this case, a prediction sample filtering procedure may befurther performed on all or some of the prediction samples of thecurrent block in some cases.

For example, the inter predictor 332 of the decoding apparatus mayinclude a prediction mode determiner 3321, a motion information deriver332_2, and a prediction sample deriver 332_3, and the prediction modedeterminer 332_1 may determine a prediction mode for the current blockbased on the received prediction mode information, the motioninformation deriver 3322 may derive motion information (a motion vectorand/or a reference picture index, etc.) of the current block based onthe received information on the motion information, and the predictionsample derivation unit 332_3 may derive prediction samples of thecurrent block.

The decoding apparatus generates residual samples for the current blockbased on the received residual information (S630). The decodingapparatus may generate reconstructed samples for the current block basedon the prediction samples and the residual samples, and generate areconstructed picture based thereon (S640). Thereafter, as describedabove, an in-loop filtering procedure may be further applied to thereconstructed picture.

As described above, the inter prediction procedure may include the stepof determining an inter prediction mode, the step of deriving motioninformation according to the determined prediction mode, and the step ofperforming prediction (generation of a prediction sample) based on thederived motion information. The inter prediction procedure may beperformed by the encoding apparatus and the decoding apparatus asdescribed above.

Meanwhile, in deriving the motion information of the current block, themotion information candidate(s) is derived based on the spatialneighboring block(s) and the temporal neighboring block(s), and themotion information candidate for the current block may be selected basedon the derived motion information candidate(s). In this case, theselected motion information candidate may be used as motion informationof the current block.

FIG. 8 is a view illustrating a merge mode in inter prediction.

When the merge mode is applied, motion information of the currentprediction block is not directly transmitted, but motion information ofthe current prediction block is derived using motion information of aneighboring prediction block. Accordingly, the motion information of thecurrent prediction block may be indicated by transmitting flaginformation indicating that the merge mode is used and a merge indexindicating which prediction block in the vicinity is used. The mergemode may be referred to as a regular merge mode.

In order to perform the merge mode, the encoding apparatus needs tosearch for a merge candidate block used to derive motion information onthe current prediction block. For example, up to five merge candidateblocks may be used, but the embodiment(s) of the present disclosure arenot limited thereto. In addition, the maximum number of merge candidateblocks may be transmitted in a slice header or a tile group header, butthe embodiment(s) of the present disclosure are not limited thereto.After finding the merge candidate blocks, the encoding apparatus maygenerate a merge candidate list, and may select a merge candidate blockhaving the smallest cost among the merge candidate blocks as a finalmerge candidate block.

The present disclosure may provide various embodiments of mergecandidate blocks constituting the merge candidate list.

For example, the merge candidate list may use five merge candidateblocks. For example, four spatial merge candidates and one temporalmerge candidate may be used. As a specific example, in the case of thespatial merge candidate, blocks illustrated in FIG. 4 may be used as thespatial merge candidates. Hereinafter, the spatial merge candidate or aspatial MVP candidate to be described later may be referred to as anSMVP, and the temporal merge candidate or a temporal MVP candidate to bedescribed later may be referred to as a TMVP.

The merge candidate list for the current block may be constructed, forexample, based on the following procedure.

The coding apparatus (encoding apparatus/decoding apparatus) may insertspatial merge candidates derived by searching for spatial neighboringblocks of the current block into the merge candidate list. For example,the spatial neighboring blocks may include a lower-left cornerneighboring block, a left neighboring block (A₁), an upper-right cornerneighboring block, an upper neighboring block, and an upper-left cornerneighboring block of the current block. However, this is an example, andin addition to the aforementioned spatial neighboring blocks, additionalneighboring blocks such as a right neighboring block, a lowerneighboring block, and a lower right neighboring block may be furtherused as the spatial neighboring blocks. The coding apparatus may detectavailable blocks by searching the spatial neighboring blocks based onpriority, and may derive motion information of the detected blocks asthe spatial merge candidates. For example, the encoding apparatus or thedecoding apparatus may search for five blocks illustrated in FIG. 8 inthe order of A1->B1->B0->A0->B2 and may configure a merge candidate listby sequentially indexing the available candidates.

The coding apparatus may search for a temporal neighboring block of thecurrent block and insert a derived temporal merge candidate into themerge candidate list. The temporal neighboring block may be positionedat a reference picture that is a different picture from the currentpicture in which the current block is positioned. The reference picturein which the temporal neighboring blocks are positioned may be called acollocated picture or a col picture. The temporal neighboring blocks maybe searched for in the order of the bottom-right corner neighboringblock and the bottom-right center block of the co-located block withrespect to the current block on the col picture. Meanwhile, when motiondata compression is applied, specific motion information may be storedas representative motion information on each predetermined storage unitin the col picture. In this case, there is no need to store motioninformation on all blocks in the predetermined storage unit, and throughthis, a motion data compression effect may be obtained. In this case,the predetermined storage unit may be predetermined as, for example,units of 16×16 samples or units of 8×8 samples, or size information onthe predetermined storage unit may be signaled from the encodingapparatus to the decoding apparatus. When the motion data compression isapplied, the motion information on the temporally neighboring blocks maybe replaced with representative motion information on the predeterminedstorage unit in which the temporally neighboring blocks are positioned.That is, in this case, from an implementation point of view, instead ofthe predicted block positioned at the coordinates of the temporallyneighboring blocks, the temporal merge candidate may be derived based onthe motion information on the prediction block covering the arithmeticleft shifted position after arithmetic right shift by a certain valuebased on the coordinates (top-left sample position) of the temporalneighboring block. For example, when the predetermined storage unit isunits of 2n×2n samples, if the coordinates of the temporally neighboringblocks are (xTnb, yTnb), the motion information on the prediction blockpositioned at the corrected position ((xTnb>>n)<<n), (yTnb>>n)<<n)) maybe used for the temporal merge candidate. Specifically, when thepredetermined storage unit is units of 16×16 samples, if the coordinatesof the temporally neighboring blocks are (xTnb, yTnb), the motioninformation on the prediction block positioned at the corrected position((xTnb>>4)<<4), (yTnb>>4)<<4)) may be used for the temporal mergecandidate. Alternatively, when the predetermined storage unit is unitsof 8×8 samples, if the coordinates of the temporally neighboring blocksare (xTnb, yTnb), the motion information on the prediction blockpositioned at the corrected position ((xTnb>>3)<<3), (yTnb>>3)<<3)) maybe used for the temporal merge candidate.

The coding apparatus may check whether the number of current mergecandidates is smaller than the number of maximum merge candidates. Themaximum number of merge candidates may be predefined or signaled fromthe encoding apparatus to the decoding apparatus. For example, theencoding apparatus may generate and encode information on the maximumnumber of merge candidates, and transmit the information to the decoderin the form of a bitstream. When the maximum number of merge candidatesis filled, the subsequent candidate addition process may not proceed.

As a result of checking, when the number of the current merge candidatesis less than the maximum number of merge candidates, the codingapparatus may insert an additional merge candidate into the mergecandidate list. For example, the additional merge candidate may includeat least one of history based merge candidate(s), a pair-wise averagemerge candidate(s), ATMVP, a combined bi-predictive merge candidate(when a slice/tile group type of the current slice/tile group is type B)and/or a zero vector merge candidate.

As a result of the check, when the number of the current mergecandidates is not smaller than the maximum number of merge candidates,the coding apparatus may terminate the construction of the mergecandidate list. In this case, the encoding apparatus may select anoptimal merge candidate from among the merge candidates constituting themerge candidate list based on rate-distortion (RD) cost, and signalselection information indicating the selected merge candidate (ex. mergeindex) to the decoding apparatus. The decoding apparatus may select theoptimal merge candidate based on the merge candidate list and theselection information.

As described above, the motion information on the selected mergecandidate may be used as the motion information on the current block,and prediction samples of the current block may be derived based on themotion information on the current block. The encoding apparatus mayderive residual samples of the current block based on the predictionsamples, and may signal residual information on the residual samples tothe decoding apparatus. As described above, the decoding apparatus maygenerate reconstructed samples based on residual samples derived basedon the residual information and the prediction samples, and may generatea reconstructed picture based thereon.

When the skip mode is applied, the motion information on the currentblock may be derived in the same way as when the merge mode is applied.However, when the skip mode is applied, the residual signal for thecorresponding block is omitted, and thus the prediction samples may bedirectly used as the reconstructed samples. The skip mode may beapplied, for example, when the value of the cu_skip_flag syntax elementis 1.

FIG. 9 is a view illustrating a merge mode with motion vector difference(MMVD) mode in inter prediction.

The MMVD mode is a method of applying motion vector difference (MVD) toa merge mode in which motion information derived to generate predictionsamples of the current block is directly used.

For example, an MMVD flag (e.g., mmvd_flag) indicating whether to useMMVD for the current block (i.e., a current CU) may be signaled, andMMVD may be performed based on this MMVD flag. When MMVD is applied tothe current block (e.g., when mmvd_flag is 1), additional information onMMVD may be signaled.

Here, the additional information on the MMVD may include a mergecandidate flag (e.g., mmvd_cand_flag) indicating whether a firstcandidate or a second candidate in the merge candidate list is usedtogether with the MVD, a distance index for indicating a motionmagnitude. (e.g., mmvd_distance_idx), and a direction index (e.g.,mmvd_direction_idx) for indicating a motion direction.

In the MMVD mode, two candidates (i.e., the first candidate or thesecond candidate) located in first and second entries among thecandidates in the merge candidate list may be used, and one of the twocandidates (i.e., the first candidate or the second candidate) may beused as a base MV. For example, a merge candidate flag (e.g.,mmvd_cand_flag) may be signaled to indicate any one of two candidates(i.e., the first candidate or the second candidate) in the mergecandidate list.

In addition, the distance index (e.g., mmvd_distance_idx) may indicatemotion size information, and may indicate a predetermined offset from astart point. Referring to FIG. 9 , the offset may be added to ahorizontal component or a vertical component of a start motion vector.The relationship between the distance index and the predetermined offsetmay be as shown in Table 3 below.

TABLE 3 mmvd_ MmvdDistance[ x0 ][ y0 ] distance_idx slice_fpel_mmvd_slice_fpel_mmvd_ [ x0 ][ y0 ] enabled_flag = = 0 enabled_flag = = 1 0 14 1 2 8 2 4 16 3 8 32 4 16 64 5 32 128 6 64 256 7 128 512

Referring to Table 3, a distance of the MVD (e.g., MmvdDistance) may bedetermined according to a value of the distance index (e.g.,mmvd_distance_idx), and the distance of the MVD (e.g., MmvdDistance) maybe derived using an integer sample precision or fractional sampleprecision based on the value of slice_fpel_mmvd_enabled_flag. Forexample, slice_fpel_mmvd_enabled_flag equal to 1 may indicate that thedistance of MVD is derived using integer sample units in the currentslice, and slice_fpel_mmvd_enabled_flag equal to 0 may indicate that thedistance of MVD is derived using fractional sample units in the currentslice.

In addition, the direction index (e.g., mmvd_direction_idx) indicates adirection of the MVD with respect to a starting point and may indicatefour directions as shown in Table 4 below. In this case, the directionof the MVD may indicate the sign of the MVD. The relationship betweenthe direction index and the MVD code may be expressed as shown in Table4 below.

TABLE 4 mmvd_direction_ MmvdSign MmvdSign idx[ x0 ][ y0 ] [ x0 ][ y0][0] [ x0 ][ y0 ][1] 0 +1 0 1 −1 0 2 0 +1 3 0 −1

Referring to Table 4, the sign of the MVD (e.g., MmvdSign) may bedetermined according to the value of the direction index (e.g.,mmvd_direction_idx), and the sign of the MVD (e.g., MmvdSign) may bederived for the L0 reference picture and the L1 reference picture.

Based on the distance index (e.g., mmvd_distance_idx) and directionindex (e.g., mmvd_direction_idx) described above, an offset of the MVDmay be calculated as shown in Equation 1 below.

MmvdOffset[x0][y0][0]=(MmvdDistance[x0][y0]<<2)*MmvdSign[x0][y0][0]

MmvdOffset[x0][y0][1]=(MmvdDistance[x0][y0]<<2)*MmvdSign[x0][y0][1]  [Equation1]

That is, in the MMVD mode, a merge candidate indicated by a mergecandidate flag (e.g., mmvd_cand_flag) is selected from among the mergecandidates of the merge candidate list derived based on the neighboringblock, and the selected merge candidate may be used as a base candidate(e.g., MVP). In addition, motion information (i.e., motion vector) ofthe current block may be derived by adding the derived MVD using adistance index (e.g., mmvd_distance_idx) and a direction index (e.g.,mmvd_direction_idx) based on the base candidate.

FIGS. 10A and 10B show CPMV for affine motion prediction

Conventionally, only one motion vector may be used to express a motionof a coding block. That is, a translation motion model was used.However, although this method may express an optimal motion in blockunits, it is not actually an optimal motion of each sample, and codingefficiency may be increased if an optimal motion vector may bedetermined in a sample unit. To this end, an affine motion model may beused. An affine motion prediction method for coding using an affinemotion model may be as follows.

The affine motion prediction method may express a motion vector in eachsample unit of a block using two, three, or four motion vectors. Forexample, the affine motion model may represent four types of motion. Theaffine motion model, which expresses three movements (translation,scale, and rotation), among the motions that the affine motion model mayexpress, may be called a similarity (or simplified) affine motion model.However, the affine motion model is not limited to the motion modeldescribed above.

Affine motion prediction may determine a motion vector of a sampleposition included in a block using two or more control point motionvectors (CPMV). In this case, the set of motion vectors may be referredto as an affine motion vector field (MVF).

For example, FIG. 10A may show a case in which two CPMVs are used, whichmay be referred to as a 4-parameter affine model. In this case, themotion vector at the (x, y) sample position may be determined as, forexample, Equation 2

$\begin{matrix}\left\{ \begin{matrix}{{mv}_{x} = {{\frac{{mv}_{1x} - {mv}_{0x}}{W}x} + {\frac{{mv}_{1y} - {mv}_{0y}}{W}y} + {mv}_{0x}}} \\{{mv}_{y} = {{\frac{{mv}_{1y} - {mv}_{0y}}{W}x} + {\frac{{mv}_{1x} - {mv}_{0x}}{W}y} + {mv}_{0y}}}\end{matrix} \right. & \left\lbrack {{Equation}2} \right\rbrack\end{matrix}$

For example, FIG. 10B may show a case in which three CPMVs are used,which may be referred to as a 6-parameter affine model. In this case,the motion vector at a (x, y) sample position may be determined, forexample, by Equation 3.

$\begin{matrix}\left\{ \begin{matrix}{{mv}_{x} = {{\frac{{mv}_{1x} - {mv}_{0x}}{W}x} + {\frac{{mv}_{2x} - {mv}_{0x}}{H}y} + {mv}_{0x}}} \\{{mv}_{y} = {{\frac{{mv}_{1y} - {mv}_{0y}}{W}x} + {\frac{{mv}_{2y} - {mv}_{0y}}{H}y} + {mv}_{0y}}}\end{matrix} \right. & \left\lbrack {{Equation}3} \right\rbrack\end{matrix}$

In Equations 2 and 3, {v_(x), v_(y)} may represent a motion vector atthe (x, y) position. In addition, {v_(0x), v_(0y)} may indicate the CPMVof a control point (CP) at the top-left corner position of the codingblock, {v_(1x), v_(1y)} may indicate the CPMV of the CP at theupper-right corner position, {v_(2x), v_(2y)} may indicate the CPMV ofthe CP at the lower left corner position. In addition, W may indicate awidth of the current block, and H may indicate a height of the currentblock

FIG. 11 exemplarily illustrates a case in which an affine MVF isdetermined in units of subblocks.

In the encoding/decoding process, the affine MVF may be determined inunits of samples or predefined subblocks. For example, when the affineMVP is determined in units of samples, a motion vector may be obtainedbased on each sample value. Alternatively, for example, when the affineMVP is determined in units of subblocks, a motion vector of thecorresponding block may be obtained based on a sample value of thecenter of the subblock (the lower right of the center, that is, thelower right sample among the four central samples). That is, in theaffine motion prediction, the motion vector of the current block may bederived in units of samples or subblocks.

In the case of FIG. 11 , the affine MVF is determined in units of 4 x4subblocks, but the size of the subblocks may be variously modified.

That is, when affine prediction is available, three motion modelsapplicable to the current block may include a translational motionmodel, a 4-parameter affine motion model, and a 6-parameter affinemotion model. The translation motion model may represent a model usingan existing block unit motion vector, the 4-parameter affine motionmodel may represent a model using two CPMVs, and the 6-parameter affinemotion model may represent a model using three CPMVs.

Meanwhile, the affine motion prediction may include an affine MVP (oraffine inter) mode or an affine merge mode

FIG. 12 is a view illustrating an affine merge mode or a subblock mergemode in inter prediction.

For example, in the affine merge mode, the CPMV may be determinedaccording to the affine motion model of the neighboring block coded bythe affine motion prediction. For example, neighboring blocks coded asaffine motion prediction in search order may be used for affine mergemode. That is, when at least one of neighboring blocks is coded in theaffine motion prediction, the current block may be coded in the affinemerge mode. Here, the fine merge mode may be called AF_MERGE.

When the affine merge mode is applied, the CPMVs of the current blockmay be derived using CPMVs of neighboring blocks. In this case, theCPMVs of the neighboring block may be used as the CPMVs of the currentblock as they are, and the CPMVs of the neighboring block may bemodified based on the size of the neighboring block and the size of thecurrent block and used as the CPMVs of the current block.

On the other hand, in the case of the affine merge mode in which themotion vector (MV) is derived in units of subblocks, it may be called asubblock merge mode, which may be indicated based on a subblock mergeflag (or a merge_subblock_flag syntax element). Alternatively, when thevalue of the merge_subblock_flag syntax element is 1, it may beindicated that the subblock merge mode is applied. In this case, anaffine merge candidate list to be described later may be called asubblock merge candidate list. In this case, the subblock mergecandidate list may further include a candidate derived by SbTMVP, whichwill be described later. In this case, the candidate derived by theSbTMVP may be used as a candidate of index 0 of the subblock mergecandidate list. In other words, the candidate derived from the SbTMVPmay be positioned before an inherited affine candidate or a constructedaffine candidate to be described later in the subblock merge candidatelist.

When the affine merge mode is applied, the affine merge candidate listmay be constructed to derive CPMVs for the current block. For example,the affine merge candidate list may include at least one of thefollowing candidates. 1) An inherited affine merge candidate. 2)Constructed affine merge candidate. 3) Zero motion vector candidate (orzero vector). Here, the inherited affine merge candidate is a candidatederived based on the CPMVs of the neighboring block when the neighboringblock is coded in affine mode, the constructed affine merge candidate isa candidate derived by constructing the CPMVs based on the MVs ofneighboring blocks of the corresponding CP in units of each CPMV, andthe zero motion vector candidate may indicate a candidate composed ofCPMVs whose value is 0.

The affine merge candidate list may be constructed as follows, forexample.

There may be up to two inherited affine candidates, and the inheritedaffine candidates may be derived from affine motion models ofneighboring blocks. The neighboring blocks may include one leftneighboring block and an upper neighboring block. Candidate blocks maybe positioned as shown in FIG. 8 . A scan order for the left predictormay be A1->A0, and a scan order for the above predictor may beB1->B0->B2. Only one inherited candidate from each of the left and abovepredictors may be selected. A pruning check may not be performed betweenthe two inherited candidates.

When a neighboring affine block is identified, control point motionvectors of the checked block may be used to derive a CPMVP candidate inthe affine merge list of the current block. Here, the neighboring affineblock may indicate a block coded in the affine prediction mode amongneighboring blocks of the current block. For example, referring to FIG.12 , when the bottom-left neighboring block A is coded in the affineprediction mode, motion vector v2, v3, and v4 at the top-left corner,the top-right corner, and bottom-left corner of the neighboring block Amay be acquired. When the neighboring block A is coded with the4-parameter affine motion model, two CPMVs of the current block may becalculated according to v2, and v4. When the neighboring block A may becalculated according to v2 and v3. When the neighboring block A is codedwith the 6-parameter affine motion model, three CPMVs of the currentblock may be calculated according to the three CPMVs v2, v3 and v4 ofthe current block.

FIG. 13 is a diagram illustrating positions of candidates in the affinemerge mode or the sub-block merge mode.

An affine candidate constructed in the affine merge mode or thesub-block merge mode may mean a candidate constructed by combiningtranslational motion information around each control point. The motioninformation of the control points may be derived from specified spatialand temporal perimeters. CPMVk (k=0, 1, 2, 3) may represent the k-thcontrol point.

Referring to FIG. 13 , blocks may be checked in the order B2->B3->A2 forCPMV0, and a motion vector of a first available block may be used. ForCPMV1, blocks may be checked according to the order of B1->B0, and forCPMV2, blocks may be checked according to the order of A1->A0. TMVP(temporal motion vector predictor) may be used with CPMV3 if available.

After motion vectors of the four control points are obtained, affinemerge candidates may be generated based on the obtained motioninformation. A combination of control point motion vectors may be anyone of {CPMV0, CPMV1, CPMV2}, {CPMV0, CPMV1, CPMV3}, {CPMV0, CPMV2,CPMV3}, {CPMV1, CPMV2, CPMV3}, {CPMV0, CPMV1}, and {CPMV0, CPMV2}.

A combination of three CPMVs may constitute a 6-parameter affine mergecandidate, and a combination of two CPMVs may constitute a 4-parameteraffine merge candidate. In order to avoid a motion scaling process, ifthe reference indices of the control points are different, the relatedcombinations of control point motion vectors may be discarded.

FIG. 14 is a view illustrating SbTMVP in inter prediction

Subblock-based temporal motion vector prediction (SbTMVP) may also bereferred to as advanced temporal motion vector prediction (ATMVP).SbTMVP may use a motion field in a collocated picture to improve motionvector prediction and merge mode for CUs in the current picture. Here,the collocated picture may be called a col picture.

For example, the SbTMVP may predict motion at a subblock (or sub-CU)level. In addition, the SbTMVP may apply a motion shift before fetchingthe temporal motion information from the col picture. Here, the motionshift may be acquired from a motion vector of one of spatiallyneighboring blocks of the current block.

The SbTMVP may predict the motion vector of a subblock (or sub-CU) inthe current block (or CU) according to two steps.

In the first step, the spatially neighboring blocks may be testedaccording to the order of A₁, B₁, B₀ and A₀ in FIG. 4 . A first spatialneighboring block having a motion vector using a col picture as itsreference picture may be checked, and the motion vector may be selectedas a motion shift to be applied. When such a motion is not checked fromspatially neighboring blocks, the motion shift may be set to (0, 0).

In the second step, a motion shift identified in the first step may beapplied to acquire sub-block level motion information (motion vector andreference indices) from the col picture. For example, the motion shiftmay be added to the coordinates of the current block. For example, themotion shift may be set to a motion of A1 of FIG. 8 . In this case, foreach sub-block, motion information of a corresponding block in the colpicture may be used to derive motion information of a sub-block.Temporal motion scaling may be applied to align reference pictures oftemporal motion vectors with reference pictures of the current block.

The combined subblock-based merge list including both the SbTVMPcandidates and the affine merge candidates may be used for signaling ofthe affine merge mode. Here, the affine merge mode may be referred to asa subblock-based merge mode. The SbTVMP mode may be available orunavailable according to a flag included in a sequence parameter set(SPS). When the SbTMVP mode is available, the SbTMVP predictor may beadded as the first entry of the list of subblock-based merge candidates,and the affine merge candidates may follow. The maximum allowable sizeof the affine merge candidate list may be five.

The size of the sub-CU (or subblock) used in the SbTMVP may be fixed to8 x8, and as in the affine merge mode, the SbTMVP mode may be appliedonly to blocks having both a width and a height of 8 or more. Theencoding logic of the additional SbTMVP merge candidate may be the sameas that of other merge candidates. That is, for each CU in the P or Bslice, an RD check using an additional rate-distortion (RD) cost may beperformed to determine whether to use the SbTMVP candidate.

FIG. 15 is a view illustrating a combined inter-picture merge andintra-picture prediction (CIIP) mode in inter prediction.

CIIP may be applied to the current CU. For example, in a case in which aCU is coded in the merge mode, the CU includes at least 64 luma samples(i.e., when the product of CU width and CU height is 64 or greater), andboth CU width and CU height are less than 128 luma samples, anadditional flag (e.g., ciip_flag) may then be signaled to indicatewhether the CIP mode is applied to the current CU.

In CIIP prediction, an inter prediction signal and an intra predictionsignal may be combined. In the CIIP mode, an inter prediction signalP_inter may be derived using the same inter prediction process appliedto the regular merge mode. An intra prediction signal P_intra may bederived according to an intra prediction process having a planar mode.

The intra prediction signal and the inter prediction signal may becombined using a weighted average, and may be expressed in Equation 4below. The weight may be calculated according to a coding mode of thetop and left neighboring blocks shown in FIG. 15 .

P _(CIIP)=((4−wt)*P _(inter) +wt P _(intra)+2)>>2  [Equation 4]

In Equation 4, when the top neighboring block is available andintra-coded, isIntraTop may be set to 1, otherwise isIntraTop may be setto 0. If the left neighboring block is available and intra-coded,isIntraLeft may be set to 1, otherwise isIntraLeft may be set to 0. When(isIntraLeft+isIntraLeft) is 2, wt may be set to 3, and when(isIntraLeft+isIntraLeft) is 1, wt may be set to 2. Otherwise wt may beset to 1.

FIG. 16 is a view illustrating a partitioning mode in inter prediction.

Referring to FIG. 12 , when a partitioning mode is applied, the CU maybe equally divided into two triangular-shaped partitions using diagonalsplit or anti-diagonal split in the opposite direction. However, this isonly an example of the partitioning mode, and a CU may be equally orunevenly divided into partitions having various shapes.

For each partition of a CU, only unidirectional prediction may beallowed. That is, each partition may have one motion vector and onereference index. The unidirectional prediction constraint is to ensurethat only two motion-compensated predictions are needed for each CU,similar to bi-prediction.

When the partitioning mode is applied, a flag indicating a splitdirection (a diagonal direction or an opposite diagonal direction) andtwo merge indices (for each partition) may be additionally signaled.

After predicting each partition, sample values based on a boundary linein a diagonal or opposite diagonal may be adjusted using blendingprocessing with adaptive weights based on adaptive weights.

Meanwhile, when the merge mode or the skip mode is applied, motioninformation may be derived based on a regular merge mode, a MMVD mode(merge mode with motion vector difference), a merge subblock mode, a CIPmode (combined inter-picture merge and intra-picture prediction mode),or a partitioning mode may be used to derive motion information togenerate prediction samples as described above. Each mode may be enabledor disabled through an on/off flag in a sequence parameter set (SPS). Ifthe on/off flag for a specific mode is disabled in the SPS, the syntaxclearly transmitted for the prediction mode in units of CUs or PUs maynot be signaled.

Table 5 below relates to a process of deriving a merge mode or a skipmode from the conventional merge_data syntax. In Table 5 below,CUMergeTriangleFlag[x0][y0] may correspond to the on/off flag for thepartitioning mode described above in FIG. 12 , andmerge_triangle_split_dir[x0] [y0] may indicate a split direction(diagonal direction or opposite diagonal direction) when thepartitioning mode is applied. In addition, merge_triangle_idx0[x0] [y0]and merge_triangle_idx1[x0] [y0] may indicate two merge indices for eachpartition when a partitioning mode is applied.

TABLE 5 Descriptor merge_data( x0, y0, cbWidth, cbHeight ) {  if (CuPredMode[ x0 ][ y0 ] = = MODE_IBC ) {   if( MaxNumMergeCand > 1 )   merge_idx[ x0 ][ y0 ] ae(v)  } else {   regular_merge_flag[ x0 ][ y0] ae(v)   if ( regular_merge_flag[ x0 ][ y0 ] = = 1 ){    if(MaxNumMergeCand > 1 )     merge_idx[ x0 ][ y0 ] ae(v)   } else {    if(sps_mmvd_enabled_flag &&    cbWidth * cbHeight != 32 )     mmvd_flag[ x0][ y0 ] ae(v)    if( mmvd_flag[ x0 ][ y0 ] = = 1 ) {     if(MaxNumMergeCand > 1 )      mmvd_merge_flag[ x0 ][ y0 ] ae(v)    mmvd_distance_idx[ x0 ][ y0 ] ae(v)     mmvd_direction_idx[ x0 ][ y0] ae(v)    } else {     if( MaxNumSubblockMergeCand > 0 && cbWidth >= 8&& cbHeight >= 8 )      merge_subblock_fag[ x0 ][ y0 ] ae(v)     if(merge_subblock_flag[ x0 ][ y0 ] = = 1 ) {      if(MaxNumSubblockMergeCand > 1 )       merge_subblock_idx[ x0 ][ y0 ] ae(v)    } else {      if( sps_ciip_enabled_flag &&      cu_skip_flag[ x0 ][y0 ] = = 0 &&       ( cbWidth * cbHeight ) >= 64 &&       cbWidth < 128&& cbHeight < 128 ) {       ciip_flag[ x0 ][ y0 ] ae(v)      if(ciip_flag[ x0 ][ y0 ] &&      MaxNumMergeCand > 1 )       merge_idx[ x0][ y0 ] ae(v)      }      if( CUMergeTriangleFlag[ x0 ][ y0 ] ) {      merge_triangle_split_dir[ x0 ][ y0 ] ae(v)      merge_triangle_idx0[ x0 ][ y0 ] ae(v)       merge_triangle_idx1[x0 ][ y0 ] ae(v)      }     }    }   }  } }

Meanwhile, each prediction mode including the regular merge mode, theMMVD mode, the merge subblock mode, the CIIP mode and the partitioningmode may be enabled or disabled from a sequence parameter set (SPS) asshown in Table 6 below. In Table 6 below, sps_triangle_enabled_flag maycorrespond to a flag that enables or disables the partitioning modedescribed above in FIG. 12 from the SPS.

TABLE 6 Descriptor seq_parameter_set_rbsp( ) { sps_decoding_parameter_set_id u(4)  sps_max_sub_layers_minus1 u(3) sps_reserved_zero_5bits u(5)  profile_tier_level(sps_max_sub_layers_minus1 )  gra_enabled_flag u(1) sps_seq_parameter_set_id ue(v)  chroma_format_idc ue(v)  if(chroma_format_idc = = 3 )   separate_colour_plane_flag u(1) pic_width_in_luma_samples ue(v)  pic_height_in_luma_samples ue(v) conformance_window_flag u(1)  if( conformance_window_flag ) {  conf_win_left_offset ue(v)   conf_win_right_offset ue(v)  conf_win_top_offset ue(v)   conf_win_bottom_offset ue(v)  } bit_depth_luma_minus8 ue(v)  bit_depth_chroma_minus8 ue(v) log2_max_pic_order_cnt_lsb_minus4 ue(v) sps_sub_layer_ordering_info_present_flag u(1)  for( i = (sps_sub_layer_ordering_info_present_flag ?  0 :sps_max_sub_layers_minus1 );    i <= sps_max_sub_layers_minus1; i++ ) {  sps_max_dec_pic_buffering_minus1[ i ] ue(v)  sps_max_num_reorder_pics[ i ] ue(v)   sps_max_latency_increase_plus1[i ] ue(v)  }  long_term_ref_pics_flag  sps_idr_rpl_present_flag u(1) rpl1_same_as_rpl0_flag u(1)  for( i = 0; i < !pl1_same_as_rpl0_flag ? 2: 1; i++ ) {   num_ref_pic_lists_in_sps[ i ] ue(v)   for( j = 0; j <num_ref_pic_lists_in_sps[ i ]; j++ )    ref_pic_list_struct( i, j )  } gtbtt_dual_tree_intra_flag u(1)  log2_ctu_size_minus2 ue(v) log2_min_luma_coding_block_size_minus2 ue(v) partition_constraints_override_enabled_flag u(1) sps_log2_diff_min_qt_min_cb_intra_slice_luma ue(v) sps_log2_diff_min_qt_min_cb_inter_slice ue(v) sps_max_mtt_hierarchy_depth_inter_slice ue(v) sps_max_mtt_hierarchy_depth_intra_slice_luma ue(v)  if(sps_max_mtt_hierarchy_depth_  intra_slice_luma != 0 ) {  sps_log2_diff_max_bt_min_qt_intra_slice_luma ue(v)  sps_log2_diff_max_tt_min_qt_intra_slice_luma ue(v)  }  if(sps_max_mtt_hierarchy_depth_inter_slices != 0 ) {  sps_log2_diff_max_bt_min_qt_inter_slice ue(v)   sps_log2_diff_tt_min_qt_inter_slice ue(v)  }  if( qtbtt_dual_tree_intra_flag ) {  sps_log2_diff_min_qt_min_cb_intra_slice_chroma ue(v)  sps_max_mtt_hierarchy_depth_intra_slice_chroma ue(v)   if (sps_max_mtt_hierarchy_depth_   intra_slice_chroma != 0 ) {   sps_log2_diff_max_bt_min_qt_intra_slice_chroma ue(v)   sps_log2_diff_max_tt_min_qt_intra_slice_chroma ue(v)   }  } sps_sao_enabled_flag u(1)  sps_alf_enabled_flag u(1) sps_pcm_enabled_flag u(1)  if( sps_pcm_enabled_flag ) {  pcm_sample_bit_depth_luma_minus1 u(4)  pcm_sample_bit_depth_chroma_minus1 u(4)  log2_min_pcm_luma_coding_block_size_minus3 ue(v)  log2_diff_max_min_pcm_luma_coding_block_size ue(v)  pcm_loop_filter_disabled_flag u(1)  }  if( ( CtbSizeY /MinCbSizeY + 1) <=  ( pic_width_in_luma_samples / MinCbSizeY − 1 ) ) {  sps_ref_wraparound_enabled_flag u(1)   if(sps_ref_wraparound_enabled_flag )    sps_ref_wraparound_offset_minus1ue(v)  }  sps_temporal_mvp_enabled_flag u(1)  if(sps_temporal_mvp_enabled_flag )   sps_sbtmvp_enabled_flag u(1) sps_amvr_enabled_flag u(1)  sps_bdof_enabled_flag u(1) sps_smvd_enabled_flag u(1)  sps_affine_amvr_enabled_flag u(1) sps_dmvr_enabled_flag u(1)  sps_mmvd_enabled_flag u(1) sps_cclm_enabled_flag u(1)  if( sps_cclm_enabled_flag && chroma_format_idc = = 1 )   sps_cclm_colocated_chroma_flag u(1) sps_mts_enabled_flag u(1)  if( sps_mts_enabled_flag ) {  sps_explicit_mts_intra_enabled_flag u(1)  sps_explicit_mts_inter_enabled_flag u(1)  }  sps_sbt_enabled_flag u(1) if( sps_sbt_enabled_flag )   sps_sbt_max_size_64_flag u(1) sps_affine_enabled_flag u(1)  if( sps_affine_enabled_flag )  sps_affine_type_flag u(1)  sps_gbi_enabled_flag u(1) sps_ibc_enabled_flag u(1)  sps_ciip_enabled_flag u(1)  if(sps_mmvd_enabled_flag )   sps_fpel_mmvd_enabled_flag u(1) sps_triangle_enabled_flag u(1)  sps_lmcs_enabled_flag u(1) sps_ladf_enabled_flag u(1)  if ( sps_ladf_enabled_flag ) {  sps_num_ladf_intervals_minus2 u(2)  sps_ladf_lowest_interval_qp_offset se(v)   for( i = 0; i <sps_num_ladf_   intervals_minus2 : 1; i++) {    sps_ladf_qp_offset[ i ]se(v)    sps_ladf_delta_threshold_minus1[ i ] ue(v)   }  } sps_extension_flag u(1)  if( sps_extension_flag )   while(more_rbsp_data( ) )    sps_extension_data_flag u(1)  rbsp_trailing_bits() }

The merge_data syntax of Table 5 may be parsed or derived according to aflag of the SPS of Table 6 and a condition in which each prediction modemay be used. Summarizing all cases according to the conditions underwhich the flag of the SPS and each prediction mode may be used are shownin Tables 7 and 8. Table 7 shows the number of cases in which thecurrent block is in the merge mode, and Table 8 shows the number ofcases in which the current block is in the skip mode. In Tables 7 and 8below, regular may correspond to the regular merge mode, mmvd maycorrespond to Triangle, or TRI may correspond to the partitioning modedescribed above with reference to FIG. 12 .

TABLE 7 SKIP 

4×8/8×4 

4×N/N×4 

8×8 

SPS 

CU 

CU 

CU 

sub- Tri- sub- sub- sub- mmvd Block CIIP angle regular mmvd Block CIIPFALL- regular mmvd Block CIIP FALL- regular mmvd Block CIIP FALL-

BACK 

BACK 

BACK 

0 

0 

0 

0 

× 

× 

× 

× 

REG 

× 

× 

× 

× 

REG 

× 

× 

× 

× 

REG 

0 

0 

0 

1 

× 

× 

× 

× 

REG 

○ 

× 

× 

× 

TRI 

○ 

× 

× 

× 

TRI 

0 

0 

1 

0 

× 

× 

× 

× 

REG 

○ 

× 

× 

× 

CIIP 

○ 

× 

× 

× 

CIIP 

0 

0 

1 

1 

× 

× 

× 

× 

REG 

○ 

× 

× 

○ 

TRI 

○ 

× 

× 

○ 

TRI 

0 

1 

0 

0 

× 

× 

× 

× 

REG 

× 

× 

× 

× 

REG 

○ 

× 

× 

× 

SUB 

0 

1 

0 

1 

× 

× 

× 

× 

REG 

○ 

× 

× 

× 

TRI 

○ 

× 

× 

× 

TRI 

0 

1 

1 

0 

× 

× 

× 

× 

REG 

○ 

× 

× 

× 

CIIP 

○ 

× 

○ 

× 

CIIP 

0 

1 

1 

1 

× 

× 

× 

× 

REG 

○ 

× 

× 

○ 

TRI 

○ 

× 

○ 

○ 

TRI 

1 

0 

0 

0 

○ 

× 

× 

× 

MMVD 

○ 

× 

× 

× 

MMVD 

○ 

× 

× 

× 

MMVD 

1 

0 

0 

1 

○ 

× 

× 

× 

MMVD 

○ 

○ 

× 

× 

TRI 

○ 

○ 

× 

× 

TRI 

1 

0 

1 

0 

○ 

× 

× 

× 

MMVD 

○ 

○ 

× 

× 

CIIP 

○ 

○ 

× 

○ 

CIIP 

1 

0 

1 

1 

○ 

× 

× 

× 

MMVD 

○ 

○ 

× 

○ 

TRI 

○ 

○ 

× 

○ 

TRI 

1 

1 

0 

0 

○ 

× 

× 

× 

MMVD 

○ 

× 

× 

× 

MMVD 

○ 

○ 

× 

× 

SUB 

1 

1 

0 

1 

○ 

× 

× 

× 

MMVD 

○ 

○ 

× 

× 

TRI 

○ 

○ 

○ 

× 

TRI 

1 

1 

1 

0 

○ 

× 

× 

× 

MMVD 

○ 

○ 

× 

× 

CIIP 

○ 

○ 

○ 

× 

CIIP 

1 

1 

1 

1 

○ 

× 

× 

× 

MMVD 

○ 

○ 

× 

○ 

TRI 

○ 

○ 

○ 

○ 

TRI 

indicates data missing or illegible when filed

TABLE 8 SKIP 

4×8/8×4 

4×N/N×4 

8×8 

SPS 

CU 

CU 

CU 

sub- Tri- sub- sub- sub- mmvd Block CIIP angle regular mmvd Block FALL-regular mmvd Block FALL- regular mmvd Block FALL-

BACK 

BACK 

BACK 

0 

0 

0 

0 

× 

× 

× 

REG 

× 

× 

× 

REG 

× 

× 

× 

REG 

0 

0 

0 

1 

× 

× 

× 

REG 

○ 

× 

× 

TRI 

○ 

× 

× 

TRI 

0 

0 

1 

0 

× 

× 

× 

REG 

× 

× 

× 

REG 

× 

× 

× 

REG 

0 

0 

1 

1 

× 

× 

× 

REG 

○ 

× 

× 

TRI 

○ 

× 

× 

TRI 

0 

1 

0 

0 

× 

× 

× 

REG 

× 

× 

× 

REG 

○ 

× 

× 

SUB 

0 

1 

0 

1 

× 

× 

× 

REG 

○ 

× 

× 

TRI 

○ 

× 

× 

TRI 

0 

1 

1 

0 

× 

× 

× 

REG 

× 

× 

× 

REG 

○ 

× 

× 

SUB 

0 

1 

1 

1 

× 

× 

× 

REG 

○ 

× 

× 

TRI 

○ 

× 

○ 

TRI 

1 

0 

0 

0 

○ 

× 

× 

MMVD 

○ 

× 

× 

MMVD 

○ 

× 

× 

MMVD 

1 

0 

0 

1 

○ 

× 

× 

MMVD 

○ 

○ 

× 

TRI 

○ 

○ 

× 

TRI 

1 

0 

1 

0 

○ 

× 

× 

MMVD 

○ 

× 

× 

MMVD 

○ 

× 

× 

MMVD 

1 

0 

1 

1 

○ 

× 

× 

MMVD 

○ 

○ 

× 

TRI 

○ 

○ 

× 

TRI 

1 

1 

0 

0 

○ 

× 

× 

MMVD 

○ 

× 

× 

MMVD 

○ 

○ 

× 

SUB 

1 

1 

0 

1 

○ 

× 

× 

MMVD 

○ 

○ 

× 

TRI 

○ 

○ 

○ 

TRI 

1 

1 

1 

0 

○ 

× 

× 

MMVD 

○ 

× 

× 

MMVD 

○ 

○ 

× 

SUB 

1 

1 

1 

1 

○ 

× 

× 

MMVD 

○ 

○ 

× 

TRI 

○ 

○ 

○ 

TRI 

indicates data missing or illegible when filed

As one example of the cases mentioned in Tables 7 and 8, a case in whichthe current block is 4 x16 and the skip mode is described. When mergesubblock mode, MMVD mode, CIIP mode, and partitioning mode are allenabled in SPS, if regular_merge_flag[x0][y0], mmvd_flag[x0][y0] andmerge_subblock_flag[x0][y0] in the merge-data syntax] are all 0, motioninformation for the current block should be derived in the partitioningmode. However, even if the partitioning mode is enabled from the on/offflag in the SPS, it may be used as the prediction mode only when theconditions of Table 9 below are additionally satisfied. In Table 9below, MergeTriangleFlag[x0][y0] may correspond to an on/off flag forthe partitioning mode, and sps_triangle_enabled_flag may correspond to aflag enabling or disabling the partitioning mode from the SPS.

TABLE 9 - If all the following conditions are true, MergeTriangleFlag[x0 ][ y0 ] is set equal to 1: - sps_triangle_enabled_flag is equalto 1. - slice_type is equal to B - merge_flag[ x0 ][ y0 ] is equla to1 - MaxNumTriangleMergeCand is larger than or equal to 2 - cbWidth *cbHeight is larger than or equal to 64 - regular_merge_flag[ x0 ][ y0 ]is equal to 0 - mmvd_flag[ x0 ][ y0 ] is equal to 0 -merge_subblock_flag[ x0 ][ y0 ] is equal to 0 - mh_intra_flag[ x0 ][ y0] is equal to 0 - Otherwise, MergeTriangleFlag[ x0 ][ y0 ] is set equalto 0.

Referring to Table 9 above, if the current slice is P slice, sinceprediction samples cannot be generated through the partitioning mode,the decoder may be unable to decode a bitstream any more. As such, inorder to solve a problem that occurs in an exceptional case in whichdecoding is not performed because a final prediction mode cannot beselected according to each on/off flag of the SPS and the merge datasyntax, in the present disclosure, a default merge mode is suggested.The default merge mode may be pre-defined in various ways or may bederived through additional syntax signaling.

In an embodiment, the regular merge mode may be applied to the currentblock based on a case in which the MMVD mode, the merge subblock mode,the CIP mode, and the partitioning mode for performing prediction bydividing the current block into two partitions are all not available.That is, when the merge mode cannot be finally selected for the currentblock, the regular merge mode may be applied as a default merge mode.

For example, although a value of the general merge flag indicatingwhether the merge mode is available for the current block is 1, if themerge mode cannot be finally selected for the current block, the regularmerge mode may be applied as a default merge mode.

In this case, prediction samples of the current block may be generatedusing merge index information indicating one of merge candidatesincluded in a merge candidate list generated by applying the regularmerge mode. For example, motion information of the current block may bederived based on merge index information indicating, and predictionsamples may be generated based on the derived motion information

Accordingly, the merge data syntax may be as shown in Table 10 below.

TABLE 10 Descriptor merge_data( x0, y0, cbWidth, cbHeight ) {  if (CuPredMode[ x0 ][ y0 ] = = MODE_IBC ) {   if( MaxNumMergeCand > 1 )   merge_idx[ x0 ][ y0 ] ae(v)  } else {   if( sps_mmvd_enabled_flag | |  cbWidth * cbHeight != 32 )    regular_merge_flag[ x0 ][ y0 ] ae(v)  if ( regular_merge_flag[ x0 ][ y0 ] = = 1 ){    if( MaxNumMergeCand >1 )     merge_idx[ x0 ][ y0 ] ae(v)   } else {    if(sps_mmvd_enabled_flag &&    cbWidth * cbHeight != 32 )    mmvd_merge_flag[ x0 ][ y0 ] ae(v)    if( mmvd_merge_flag[ x0 ][ y0 ]= = 1 ) {     if( MaxNumMergeCand > 1 )      mmvd_cand_flag[ x0 ][ y0 ]ae(v)     mmvd_distance_idx[ x0 ][ y0 ] ae(v)     mmvd_direction_idx[ x0][ y0 ] ae(v)    } else {     if( MaxNumSubblockMergeCand > 0 &&    cbWidth >= 8 && cbHeight >= 8 )     if( MaxNumSubblockMergeCand > 0&&     cbWidth >= 8 && cbHeight >= 8 )          merge_subblock_ ae(v)         flag[ x0 ][ y0 ]         if( merge_subblock_flag         [ x0][ y0 ] = = 1 ) {          if( MaxNumSubblock-          MergeCand > 1 )          merge_subblock_ ae(v)           idx[ x0 ][ y0 ]         } else{          if( sps_ciip_enabled_flag &&          cu_skip_flag[ x0 ]         [ y0 ] = = 0 &&           ( cbWidth *           cbHeight ) >=64 &&           cbWidth < 128 &&           cbHeight < 128 )     {          ciip_flag[ x0 ][ y0 ] ae(v)          if( ciip_flag[ x0 ][ y0 ]&          MaxNumMergeCand > 1 )           merge_idx[ x0 ][ y0 ] ae(v)         }          if( MergeTriangle-          Flag[ x0 ][ y0 ] ) {          merge_triangle_split_ ae(v)           dir[ x0 ][ y0 ]          merge_triangle_ ae(v)           idx0[ x0 ][ y0 ]          merge_triangle_ ae(v)           idx1[ x0 ][ y0 ]          }         if( !ciip_flag[x0][y0] &&          !MergeTriangle-         Flag[x0][y0]) {           if( MaxNum-           MergeCand > 1 )           merge_idx[ x0 ][ y0 ]          }         }        }       }     }     }

Referring to Table 10 and Table 6, based on a case in which the MMVDmode is not available, a flag sps_mmvd_enabled_flag for enabling ordisabling the MMVD mode from the SPS may be 0 or a first flag(mmvd_merge_flag[x0][y0]) indicating whether or not the MMVD mode isapplied may be 0.

In addition, based on a case in which the merge subblock mode is notavailable, a flag sps_affine_enabled_flag for enabling or disabling themerge subblock mode from the SPS may be 0 or a second flag(merge_subblock_flag[x0][y0]) indicating whether the merge subblock modeis applied may be 0.

In addition, based on a case in which the CIIP mode is not available, aflag sps_ciip_enabled_flag for enabling or disabling the CIP mode fromthe SPS may be 0 or a third flag (ciip_flag[x0][y0]) indicating whetherthe CIP mode is applied may be 0.

In addition, based on a case in which the partitioning mode is notavailable, a flag sps_triangle_enabled_flag for enabling or disablingthe partitioning mode from the SPS may be 0 or a fourth flag(MergeTriangleFlag[x0][y0]) indicating whether the partitioning mode isapplied may be 0.

Meanwhile, for example, based on that a value of the general merge.flagindicating whether a merge mode is available for the current block is 1,values of a first flag mmvd_merge_flag[x0][y0] indicating whether theMMVD mode is applied, a second flag merge_subblock_flag[x0][y0]indicating whether the merge subblock mode is applied, and a third flagciip_flag[x0][y0] indicating whether the CIP mode applied may besignaled.

Also, for example, based on a case in which the partitioning mode isdisabled based on the flag sps_triangle_enabled_flag, the fourth flag(MergeTriangleFlag[x0][y0]) indicating whether the partitioning mode isapplied may be set to 0.

In another embodiment, based on that the regular merge mode, the MMVDmode, the merge subblock mode, the CIP mode, and the partitioning modefor performing prediction by dividing the current block into twopartitions, the regular merge mode may be applied to the current block.That is, when the merge mode cannot be finally selected for the currentblock, the regular merge mode may be applied as a default merge mode

For example, based on the general merge flag indicating whether themerge mode is available for the current block, in a case in which amerge mode cannot be finally selected for the current block although themerge mode is available for the current block, the regular merge modemay be applied as a default merge mode.

For example, based on a case in which the MMVD mode is not available, aflag sps_mmvd_enabled_flag for enabling or disabling the MMVD mode fromthe SPS may be 0 or a first flag (mmvd_merge_flag[x0] [y0]) indicatingwhether the MMVD mode is applied may be 0.

In addition, based on a case in which the merge subblock mode is notavailable, a flag sps_affine_enabled_flag for enabling or disabling themerge subblock mode from the SPS may be 0 or the second flag(merge_subblock_flag[x0][y0]) indicating whether the merge subblock modeis applied may be 0.

In addition, based on a case in which the CIP mode is not available, aflag sps_ciip_enabled_flag for enabling or disabling the CIP mode fromthe SPS may be 0 or a third flag (ciip_flag[x0][y0]) indicating whetherthe CIP mode is applied may be 0.

In addition, based on a case in which the partitioning mode is notavailable, a flag sps_triangle_enabled_flag for enabling or disablingthe partitioning mode from the SPS may be 0 or a fourth flag(MergeTriangleFlag[x0][y0]) indicating whether the partitioning mode isapplied may be 0.

Also, based on a case in which the regular merge mode is not available,a fifth flag (regular_merge_flag[x0][y0]) indicating whether the regularmerge mode is applied may be 0. That is, even when the value of thefifth flag is 0, the regular merge mode may be applied to the currentblock based on a case in which the MMVD mode, the merge subblock mode,the CIP mode, and the partitioning mode are not available.

In this case, motion information of the current block may be derivedbased on a first candidate among merge candidates included in the mergecandidate list of the current block, and prediction samples may begenerated based on the derived motion information.

In another embodiment, the regular merge mode may be applied to thecurrent block based on that the regular merge mode, the MMVD mode, themerge subblock mode, the CIIP mode, and the partitioning mode forperforming prediction by dividing the current block into two partitionsare not available. That is, when a merge mode is finally selected forthe current block, the regular merge mode may be applied as a defaultmerge mode.

For example, in a case in which the value of the general merge flagindicating whether the merge mode is available for the current block is1 but a merge mode is not finally selected for the current block, theregular merge mode may be applied as a default merge mode.

For example, based on a case in which the MMVD mode is not available, aflag sps_mmvd_enabled_flag for enabling or disabling the MMVD mode fromthe SPS may be 0 or a first flag (mmvd_merge_flag[x0] [y0]) indicatingwhether the MMVD mode is applied may be 0.

In addition, based on a case in which the merge subblock mode is notavailable, the flag sps_affine_enabled_flag for enabling or disablingthe merge subblock mode from the SPS may be 0 or the second flag(merge_subblock_flag[x0][y0]) indicating whether the merge subblock modeis applied may be 0.

In addition, based on a case in which the CIP mode is not available, aflag sps_ciip_enabled_flag for enabling or disabling the CIP mode fromthe SPS may be 0 or a third flag (ciip_flag[x0][y0]) indicating whetherthe CIP mode is applied may be 0.

In addition, based on a case in which the partitioning mode is notavailable, a flag sps_triangle_enabled_flag for enabling or disablingthe partitioning mode from the SPS may be 0 or a fourth flag(MergeTriangleFlag[x0][y0]) indicating whether the partitioning mode isapplied may be 0.

Also, based on a case in which the regular merge mode is not available,a fifth flag (regular_merge_flag[x0][y0]) indicating whether the regularmerge mode is applied may be 0. That is, even when the value of thefifth flag is 0, the regular merge mode may be applied to the currentblock based on a case in which the MMVD mode, the merge subblock mode,the CIIP mode, and the partitioning mode are not available.

In this case, a (0, 0) motion vector may be derived as motioninformation of the current block, and prediction samples of the currentblock may be generated based on the (0, 0) motion information. For the(0, 0) motion vector, prediction may be performed with reference to a0th reference picture of an L0 reference list. However, when the 0threference picture (RefPicList[0][0]) of the L0 reference list does notexist, prediction may be performed by referring to a 0th referencepicture (RefPicList[1][0]) of an L1 reference list.

FIGS. 17 and 18 schematically show an example of a video/image encodingmethod and related components according to embodiment(s) of the presentdisclosure.

The method disclosed in FIG. 17 may be performed by the encodingapparatus disclosed in FIG. 2 or FIG. 18 . Specifically, for example,steps S1700 to S1710 of FIG. 17 may be performed by the predictor 220 ofthe encoding apparatus 200 of FIG. 18 , and step S1720 of FIG. 17 may beperformed by the residual processor 230 of the encoding apparatus 200 ofFIG. 18 . Step S1730 of FIG. 17 may be performed by the entropy encoder240 of the encoding apparatus 200 of FIG. 18 . The method disclosed inFIG. 17 may include the embodiments described above in the presentdisclosure

Referring to FIG. 17 , the encoding apparatus may determine an interprediction mode of the current block and generate inter prediction modeinformation indicating the inter prediction mode (S1700). For example,the encoding apparatus may determine at least one of a regular mergemode, a skip mode, a motion vector prediction (MVP) mode, a merge modewith motion vector difference (MMVD), a merge subblock mode, a CIIP mode(combined inter-picture merge and intra-picture prediction mode), and apartitioning mode that performs prediction by dividing the current blockinto two partitions, as an inter prediction mode to be applied to thecurrent block and generate inter prediction mode information indicatingthe inter prediction mode.

The encoding apparatus may generate prediction samples of the currentblock based on the determined prediction mode (S1710). For example, theencoding apparatus may generate a merge candidate list according to thedetermined inter prediction mode.

For example, candidates may be inserted into the merge candidate listuntil the number of candidates in the merge candidate list is a maximumnumber of candidates. Here, the candidate may indicate a candidate or acandidate block for deriving motion information (or motion vector) ofthe current block. For example, the candidate block may be derived bysearching for neighboring blocks of the current block. For example, theneighboring block may include a spatial neighboring block and/or atemporal neighboring block of the current block, and a spatialneighboring block may be searched preferentially (spatial merge) toderive a candidate, and then the temporal neighboring block may besearched and derived as a (temporal merge) candidate, and the derivedcandidates may be inserted into the merge candidate list. For example,when the number of candidates in the merge candidate list is less thanthe maximum number of candidates in the merge candidate list even afterthe candidates are inserted, an additional candidate may be inserted.For example, the additional candidate may include at least one ofhistory based merge candidate(s), pair-wise average merge candidate(s),ATMVP, and combined bi-predictive merge candidates (when the slice/tilegroup type of the current slice/tile group is type B)) and/or a zerovector merge candidate.

As described above, the merge candidate list may include at least someof a spatial merge candidate, a temporal merge candidate, a pairwisecandidate, or a zero vector candidate, and one of these candidates maybe selected for inter prediction of the current block

For example, the selection information may include index informationindicating one candidate among merge candidates included in the mergecandidate list. For example, the selection information may be referredto as merge index information.

For example, the encoding apparatus may generate prediction samples ofthe current block based on the candidate indicated by the merge indexinformation. Alternatively, for example, the encoding apparatus mayderive motion information based on the candidate indicated by the mergeindex information, and may generate prediction samples of the currentblock based on the motion information.

Meanwhile, according to an embodiment, the inter prediction modeinformation includes a general merge flag indicating whether a mergemode is available for the current block, and based on the general mergeflag, a merge mode is available to the current block.

At this time, based on that the MMVD mode (merge mode with motion vectordifference), the merge subblock mode, the CIP mode (combinedinter-picture merge and intra-picture prediction mode), and thepartitioning mode for performing prediction by dividing the currentblock into partitions are not available, the regular merge mode may be.

For example, the inter prediction mode information may include mergeindex information indicating one of the merge candidates included in themerge candidate list generated by applying the regular merge mode, andthe prediction samples may be generated using the merge indexinformation. That is, motion information of the current block may bederived based on the candidate indicated by the merge index information,and prediction samples of the current block may be generated based onthe derived motion information

For example, the inter prediction mode information may include a firstflag indicating whether the MMVD mode is applied, a second flagindicating whether the merge subblock mode is applied, and a third flagindicating whether the CIP mode is applied.

For example, based on a case in which the MMVD mode, the merge subblockmode, the CIP mode, and the partitioning mode are not available, thevalues of the first flag, the second flag, and the third flag may all be0.

Also, for example, based on a case in which the value of the generalmerge flag is 1, the merge mode may be available for the current block,and based on a case in which the general merge mode flag is 1, values ofthe first flag, the second flag, and the third flag may be signaled.

For example, a flag for enabling or disabling the partitioning mode maybe included in a sequence parameter set (SPS) of the image information,and based on a case in which the partitioning mode is disabled, thevalue of the fourth flag indicating whether the partitioning mode isapplied may be set to 0.

Meanwhile, the inter prediction mode information may further include afifth flag indicating whether the regular merge mode is applied. Evenwhen the value of the fifth flag is 0, the regular merge mode may beapplied to the current block based on a case in which the MMVD mode, themerge subblock mode, the CIP mode, and the partitioning mode are notavailable.

In this case, the motion information of the current block may be derivedbased on a first merge candidate among merge candidates included in themerge candidate list of the current block. Also, the prediction samplesmay be generated based on the motion information of the current blockderived based on the first merge candidate.

Alternatively, in this case, the motion information of the current blockmay be derived based on the (0,0) motion vector, and the predictionsamples may be generated based on the motion information of the currentblock derived based on the (0,0) motion vector.

The encoding apparatus may generate residual information based onresidual samples for the current block (S1720). For example, theencoding apparatus may derive residual samples based on the predictionsamples and the original samples. For example, the encoding apparatusmay generate residual information indicating quantized transformcoefficients of the residual sample. The residual information may begenerated through various encoding methods such as exponential Golomb,CAVLC, CABAC, and the like.

The encoding apparatus may encode image information including interprediction mode information and residual information (S1730). Forexample, the image information may be referred to as video information.The image information may include various information according to theembodiment(s) of the present disclosure described above. For example,the image information may include at least some of prediction-relatedinformation or residual-related information. For example, theprediction-related information may include at least some of the interprediction mode information, selection information, and inter predictiontype information. For example, the encoding apparatus may encode imageinformation including all or part of the aforementioned information (orsyntax elements) to generate a bit stream or encoded information. Or,the encoding apparatus may output the information in the form of abitstream. In addition, the bitstream or encoded information may betransmitted to the decoding apparatus through a network or a storagemedium.

Alternatively, although not shown in FIG. 17 , for example, the encodingapparatus may generate reconstructed samples based on the residualsamples and the prediction samples. A reconstructed block and areconstructed picture may be derived based on the reconstructed samples.Alternatively, for example, the encoding apparatus may encode imageinformation including residual information or prediction-relatedinformation.

For example, the encoding apparatus may generate a bitstream or encodedinformation by encoding image information including all or part of theaforementioned information (or syntax elements). Alternatively, theencoding apparatus may be output the information in the form of abitstream. In addition, the bitstream or encoded information may betransmitted to the decoding apparatus through a network or a storagemedium. Alternatively, the bitstream or the encoded information may bestored in a computer-readable storage medium, and the bitstream or theencoded information may be generated by the aforementioned imageencoding method.

FIGS. 19 and 20 schematically show an example of a video/image decodingmethod and related components according to embodiment(s) of the presentdisclosure.

The method disclosed in FIG. 19 may be performed by the decodingapparatus illustrated in FIG. 3 or 20 . Specifically, for example, stepS1900 in FIG. 19 may be performed by the entropy decoder 310 of thedecoding apparatus 300 in FIG. 20 , and step S1910 in FIG. 19 may beperformed by the residual processor 320 of the decoding apparatus 300 inFIG. 20 . Also, step S1920 of FIG. 19 may be performed by the predictor330 of the decoding apparatus in FIG. 20 , and S1930 of FIG. 19 may beperformed by the adder 340 of the decoding apparatus 300 in FIG. 20 .The method disclosed in FIG. 19 may include the embodiments describedabove in the present disclosure.

Referring to FIG. 19 , the decoding apparatus may receive imageinformation including inter prediction mode information and residualinformation through the bitstream (S1900). For example, the imageinformation may be referred to as video information. The imageinformation may include various information according to theaforementioned embodiment(s) of the present disclosure. For example, theimage information may include at least a part of prediction-relatedinformation or residual-related information.

For example, the prediction-related information may include interprediction mode information or inter prediction type information. Forexample, the inter prediction mode information may include informationindicating at least some of various inter prediction modes. For example,various modes such as a regular merge mode, a skip mode, an MVP (motionvector prediction) mode, an MMVD mode (merge mode with motion vectordifference), a merge subblock mode, a CIP mode (combined inter-picturemerge and intra-picture prediction mode) and a partitioning modeperforming prediction by dividing the current block into two partitionsmay be used. For example, the inter prediction type information mayinclude an inter_pred_idc syntax element. Alternatively, the interprediction type information may include information indicating any oneof L0 prediction, L1 prediction, and bi-prediction.

The decoding apparatus may generate residual samples based on theresidual information (S1910). The decoding apparatus may derivequantized transform coefficients based on the residual information, andmay derive residual samples based on an inverse transform procedure forthe transform coefficients.

The decoding apparatus may generate prediction samples of the currentblock by applying a prediction mode determined based on the interprediction mode information. For example, the decoding apparatus maygenerate a merge candidate list according to a determined interprediction mode among the regular merge mode, the skip mode, the MVPmode, the MMVD mode, the merge subblock mode, the CIP mode, and thepartitioning mode performing prediction by dividing the current blockinto two partitions, as an inter prediction mode of the current blockbased on the inter prediction mode information.

For example, candidates may be inserted into the merge candidate listuntil the number of candidates in the merge candidate list is a maximumnumber of candidates. Here, the candidate may indicate a candidate or acandidate block for deriving motion information (or motion vector) ofthe current block. For example, the candidate block may be derived bysearching for neighboring blocks of the current block. For example, theneighboring block may include a spatial neighboring block and/or atemporal neighboring block of the current block, and a spatialneighboring block may be searched preferentially (spatial merge) toderive a candidate, and then the temporal neighboring block may besearched and derived as a (temporal merge) candidate, and the derivedcandidates may be inserted into the merge candidate list. For example,when the number of candidates in the merge candidate list is less thanthe maximum number of candidates in the merge candidate list even afterthe candidates are inserted, an additional candidate may be inserted.For example, the additional candidate may include at least one ofhistory based merge candidate(s), pair-wise average merge candidate(s),ATMVP, and combined bi-predictive merge candidates (when the slice/tilegroup type of the current slice/tile group is type B)) and/or a zerovector merge candidate.

As described above, the merge candidate list may include at least someof a spatial merge candidate, a temporal merge candidate, a pairwisecandidate, or a zero vector candidate, and one of these candidates maybe selected for inter prediction of the current block.

For example, the selection information may include index informationindicating one candidate among merge candidates included in the mergecandidate list. For example, the selection information may be referredto as merge index information.

For example, the decoding apparatus may generate prediction samples ofthe current block based on the candidate indicated by the merge indexinformation. Alternatively, for example, the decoding apparatus mayderive motion information based on the candidate indicated by the mergeindex information, and may generate prediction samples of the currentblock based on the motion information.

Meanwhile, according to an embodiment, the inter prediction modeinformation may include a general merge flag indicating whether a mergemode is available for the current block, and the merge mode may beavailable for the current block based on the general merge flag.

Here, based on that the merge mode with motion vector difference (MMVD)mode, the merge subblock mode, the combined inter-picture merge andintra-picture prediction (CIIP) mode, and the partitioning mode forperforming prediction by dividing the current block into two partitionsare not available, the regular merge mode may be applied.

For example, the inter prediction mode information may include mergeindex information indicating one of the merge candidates included in themerge candidate list generated by applying the regular merge mode, andprediction samples may be generated using the merge index information.That is, motion information of the current block may be derived based onthe candidate indicated by the merge index information, and predictionsamples of the current block may be generated based on the derivedmotion information.

For example, the inter prediction mode information may include a firstflag indicating whether the MMVD mode is applied, a second flagindicating whether the merge subblock mode is applied, and a third flagindicating whether the CIP mode is applied.

For example, based on a case in which the MMVD mode, the merge subblockmode, the CIP mode, and the partitioning mode are not available, thevalues of the first flag, the second flag, and the third flag may all be0.

Also, for example, the merge mode is enabled for the current block basedon a case in which the value of the general merge flag is 1, and thevalues of the first flag, the second flag, and the third flag may besignaled based on a case in which the value of the general merge flag is1.

For example, a flag for enabling or disabling the partitioning mode maybe included in a sequence parameter set (SPS) of the image information,and based on a case in which the partitioning mode is disabled, thevalue of the fourth flag indicating whether the partitioning mode isapplied may be set to 0.

Meanwhile, the inter prediction mode information may further include afifth flag indicating whether the regular merge mode is applied. Evenwhen the value of the fifth flag is 0, the regular merge mode may beapplied to the current block based on a case in which the MMVD mode, themerge subblock mode, the CIP mode, and the partitioning mode are notavailable.

In this case, the motion information of the current block may be derivedbased on a first merge candidate among merge candidates included in themerge candidate list of the current block. Also, the prediction samplesmay be generated based on the motion information of the current blockderived based on the first merge candidate.

Alternatively, in this case, the motion information of the current blockmay be derived based on the (0,0) motion vector, and the predictionsamples may be generated based on the motion information of the currentblock derived based on the (0,0) motion vector.

The decoding apparatus may generate reconstructed samples based on theprediction samples and the residual samples (S1930). For example, thedecoding apparatus may generate reconstructed samples based on theprediction samples and residual samples, and a reconstructed block and areconstructed picture may be derived based on the reconstructed samples.

For example, the decoding apparatus may obtain image informationincluding all or parts of the above-described pieces of information (orsyntax elements) by decoding the bitstream or the encoded information.Further, the bitstream or the encoded information may be stored in acomputer readable storage medium, and may cause the above-describeddecoding method to be performed.

Although methods have been described on the basis of a flowchart inwhich steps or blocks are listed in sequence in the above-describedembodiments, the steps of the present document are not limited to acertain order, and a certain step may be performed in a different stepor in a different order or concurrently with respect to that describedabove. Further, it will be understood by those ordinary skilled in theart that the steps of the flowcharts are not exclusive, and another stepmay be included therein or one or more steps in the flowchart may bedeleted without exerting an influence on the scope of the presentdisclosure.

The aforementioned method according to the present disclosure may be inthe form of software, and the encoding apparatus and/or decodingapparatus according to the present disclosure may be included in adevice for performing image processing, for example, a TV, a computer, asmart phone, a set-top box, a display device, or the like.

When the embodiments of the present disclosure are implemented bysoftware, the aforementioned method may be implemented by a module(process or function) which performs the aforementioned function. Themodule may be stored in a memory and executed by a processor. The memorymay be installed inside or outside the processor and may be connected tothe processor via various well-known means. The processor may includeApplication-Specific Integrated Circuit (ASIC), other chipsets, alogical circuit, and/or a data processing device. The memory may includea Read-Only Memory (ROM), a Random Access Memory (RAM), a flash memory,a memory card, a storage medium, and/or other storage device. In otherwords, the embodiments according to the present disclosure may beimplemented and executed on a processor, a micro-processor, acontroller, or a chip. For example, functional units illustrated in therespective figures may be implemented and executed on a computer, aprocessor, a microprocessor, a controller, or a chip. In this case,information on implementation (for example, information on instructions)or algorithms may be stored in a digital storage medium.

In addition, the decoding apparatus and the encoding apparatus to whichthe embodiment(s) of the present document is applied may be included ina multimedia broadcasting transceiver, a mobile communication terminal,a home cinema video device, a digital cinema video device, asurveillance camera, a video chat device, and a real time communicationdevice such as video communication, a mobile streaming device, a storagemedium, a camcorder, a video on demand (VoD) service provider, an OverThe Top (OTT) video device, an internet streaming service provider, a 3Dvideo device, a Virtual Reality (VR) device, an Augment Reality (AR)device, an image telephone video device, a vehicle terminal (forexample, a vehicle (including an autonomous vehicle) terminal, anairplane terminal, or a ship terminal), and a medical video device; andmay be used to process an image signal or data. For example, the OTTvideo device may include a game console, a Bluray player, anInternet-connected TV, a home theater system, a smartphone, a tablet PC,and a Digital Video Recorder (DVR).

In addition, the processing method to which the embodiment(s) of thepresent document is applied may be produced in the form of a programexecuted by a computer and may be stored in a computer-readablerecording medium. Multimedia data having a data structure according tothe embodiment(s) of the present document may also be stored in thecomputer-readable recording medium. The computer readable recordingmedium includes all kinds of storage devices and distributed storagedevices in which computer readable data is stored. The computer-readablerecording medium may include, for example, a Bluray disc (BD), auniversal serial bus (USB), a ROM, a PROM, an EPROM, an EEPROM, a RAM, aCD-ROM, a magnetic tape, a floppy disk, and an optical data storagedevice. The computer-readable recording medium also includes mediaembodied in the form of a carrier wave (for example, transmission overthe Internet). In addition, a bitstream generated by the encoding methodmay be stored in the computer-readable recording medium or transmittedthrough a wired or wireless communication network.

In addition, the embodiment(s) of the present document may be embodiedas a computer program product based on a program code, and the programcode may be executed on a computer according to the embodiment(s) of thepresent document. The program code may be stored on a computer-readablecarrier.

FIG. 21 represents an example of a contents streaming system to whichthe embodiment of the present document may be applied.

Referring to FIG. 21 , the content streaming system to which theembodiments of the present document is applied may generally include anencoding server, a streaming server, a web server, a media storage, auser device, and a multimedia input device.

The encoding server functions to compress to digital data the contentsinput from the multimedia input devices, such as the smart phone, thecamera, the camcorder and the like, to generate a bitstream, and totransmit it to the streaming server. As another example, in a case wherethe multimedia input device, such as, the smart phone, the camera, thecamcorder or the like, directly generates a bitstream, the encodingserver may be omitted.

The bitstream may be generated by an encoding method or a bitstreamgeneration method to which the embodiments of the present document isapplied. And the streaming server may temporarily store the bitstream ina process of transmitting or receiving the bitstream.

The streaming server transmits multimedia data to the user equipment onthe basis of a user's request through the web server, which functions asan instrument that informs a user of what service there is. When theuser requests a service which the user wants, the web server transfersthe request to the streaming server, and the streaming server transmitsmultimedia data to the user. In this regard, the contents streamingsystem may include a separate control server, and in this case, thecontrol server functions to control commands/responses betweenrespective equipment in the content streaming system.

The streaming server may receive contents from the media storage and/orthe encoding server. For example, in a case the contents are receivedfrom the encoding server, the contents may be received in real time. Inthis case, the streaming server may store the bitstream for apredetermined period of time to provide the streaming service smoothly.

For example, the user equipment may include a mobile phone, a smartphone, a laptop computer, a digital broadcasting terminal, a personaldigital assistant (PDA), a portable multimedia player (PMP), anavigation, a slate PC, a tablet PC, an ultrabook, a wearable device(e.g., a watch-type terminal (smart watch), a glass-type terminal (smartglass), a head mounted display (HMD)), a digital TV, a desktop computer,a digital signage or the like.

Each of servers in the contents streaming system may be operated as adistributed server, and in this case, data received by each server maybe processed in distributed manner.

Claims in the present description can be combined in a various way. Forexample, technical features in method claims of the present descriptioncan be combined to be implemented or performed in an apparatus, andtechnical features in apparatus claims can be combined to be implementedor performed in a method. Further, technical features in method claim(s)and apparatus claim(s) can be combined to be implemented or performed inan apparatus. Further, technical features in method claim(s) andapparatus claim(s) can be combined to be implemented or performed in amethod.

1.-15. (canceled)
 16. A decoding apparatus for image decoding, the decoding apparatus comprising: a memory; and at least one processor connected to the memory, the at least one processor configured to: acquire image information including inter prediction mode information and residual information through a bitstream; generate residual samples based on the residual information; generate prediction samples of a current block by applying a prediction mode determined based on the inter prediction mode information; and generate reconstructed samples based on the prediction samples and the residual samples, wherein the inter prediction mode information includes at least one of a first flag related to whether a subblock merge mode is applied, a second flag related to whether a regular merge mode is applied, a third flag related to whether a merge mode with motion vector difference (MMVD) is applied or a fourth flag related to whether a combined inter-picture merge and intra-picture prediction (CIP) mode is applied, wherein a parsing order of the second flag related to whether the regular merge mode is applied precedes a parsing order of the third flag related to whether the MMVD is applied and a parsing order of the fourth flag related to whether the CIP mode is applied, wherein, based on the CIP mode being not enabled, a partitioning prediction mode in which prediction is performed by dividing the current block into two partitions being not enabled, a value of the first flag being equal to 0 and a value of the third flag being equal to 0, whether a maximum number of merging candidate is greater than a specific value is determined, wherein, based on the CIP mode being not enabled, the partitioning prediction mode being not enabled, the value of the first flag being equal to 0, the value of the third flag being equal to 0 and the maximum number of merging candidate being not greater than the specific value, merge index information indicating one of merge candidates included in a merge candidate list is not obtained, and wherein, based on the merge index information being not obtained, a firstly-ordered merge candidate in a merge candidate list is used for generating the prediction samples.
 17. The decoding apparatus of claim 16, wherein a flag enabling or disabling the partitioning prediction mode is included in a sequence parameter set (SPS) of the image information.
 18. An encoding apparatus for image encoding, the encoding apparatus comprising: a memory; and at least one processor connected to the memory, the at least one processor configured to: determine an inter prediction mode of a current block and generate inter prediction mode information indicating the inter prediction mode; generate prediction samples of the current block based on the determined prediction mode; generate residual information based on residual samples for the current block; and encode image information including the inter prediction mode information and the residual information, wherein the inter prediction mode information includes at least one of a first flag related to whether a subblock merge mode is applied, a second flag related to whether a regular merge mode is applied, a third flag related to whether a merge mode with motion vector difference (MMVD) is applied or a fourth flag related to whether a combined inter-picture merge and intra-picture prediction (CIIP) mode is applied, wherein a parsing order of the second flag related to whether the regular merge mode is applied precedes a parsing order of the third flag related to whether the MMVD is applied and a parsing order of the fourth flag related to whether the CIP mode is applied, wherein based on the CIP mode being not enabled, a partitioning prediction mode in which prediction is performed by dividing the current block into two partitions being not enabled, a value of the first flag being equal to 0 and a value of the third flag being equal to 0, whether a maximum number of merging candidate is greater than a specific value is determined, wherein, based on the CIIP mode being not enabled, the partitioning prediction mode being not enabled, the value of the first flag being equal to 0, the value of the third flag being equal to 0 and the maximum number of merging candidate being not greater than the specific value, merge index information indicating one of merge candidates included in a merge candidate list is not obtained, and wherein, based on the merge index information being not obtained, a firstly-ordered merge candidate in a merge candidate list is used for generating the prediction samples.
 19. The encoding apparatus of claim 18, wherein a flag enabling or disabling the partitioning prediction mode is included in a sequence parameter set (SPS) of the image information.
 20. The decoding apparatus of claim 16, wherein the partitioning prediction mode is available to the current block based on a value of an enabled flag for the partitioning prediction mode being equal to 1, a slice type is equal to B, a value of the second flag being equal to 0, the value of the first flag being equal to 0, the value of the third flag being equal to
 0. 21. The encoding apparatus of claim 18, wherein the partitioning prediction mode is available to the current block based on a value of an enabled flag for the partitioning prediction mode being equal to 1, a slice type is equal to B, a value of the second flag being equal to 0, the value of the first flag being equal to 0, the value of the third flag being equal to
 0. 22. An apparatus for transmitting data for an image, the apparatus comprising: at least one processor configured to obtain a bitstream for the image, wherein the bitstream is generated based on determining an inter prediction mode of a current block and generating inter prediction mode information indicating the inter prediction mode, generating prediction samples of the current block based on the determined prediction mode, generating residual information based on residual samples for the current block, and encoding image information including the inter prediction mode information and the residual information; and a transmitter configured to transmit the data comprising the bitstream, wherein the inter prediction mode information includes at least one of a first flag related to whether a subblock merge mode is applied, a second flag related to whether a regular merge mode is applied, a third flag related to whether a merge mode with motion vector difference (MMVD) is applied or a fourth flag related to whether a combined inter-picture merge and intra-picture prediction (CIIP) mode is applied, wherein a parsing order of the second flag related to whether the regular merge mode is applied precedes a parsing order of the third flag related to whether the MMVD is applied and a parsing order of the fourth flag related to whether the CIP mode is applied, wherein based on the CIP mode being not enabled, a partitioning prediction mode in which prediction is performed by dividing the current block into two partitions being not enabled, a value of the first flag being equal to 0 and a value of the third flag being equal to 0, whether a maximum number of merging candidate is greater than a specific value is determined, wherein, based on the CIP mode being not enabled, the partitioning prediction mode being not enabled, the value of the first flag being equal to 0, the value of the third flag being equal to 0 and the maximum number of merging candidate being not greater than the specific value, merge index information indicating one of merge candidates included in a merge candidate list is not obtained, and wherein, based on the merge index information being not obtained, a firstly-ordered merge candidate in a merge candidate list is used for generating the prediction samples. 